Skip to content

Commit

Permalink
Add: add material banner
Browse files Browse the repository at this point in the history
  • Loading branch information
ybmin committed Sep 10, 2023
1 parent 0a0871b commit 369ffa4
Show file tree
Hide file tree
Showing 2 changed files with 218 additions and 0 deletions.
128 changes: 128 additions & 0 deletions lib/constants/theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

//primaryColor 지정 (색상코드: #6E3647)
final Map<int, Color> primaryColor1 = {
50: const Color.fromRGBO(110, 54, 120, .1),
100: const Color.fromRGBO(110, 54, 120, .2),
200: const Color.fromRGBO(110, 54, 120, .3),
300: const Color.fromRGBO(110, 54, 120, .4),
400: const Color.fromRGBO(110, 54, 120, .5),
500: const Color.fromRGBO(110, 54, 120, .6),
600: const Color.fromRGBO(110, 54, 120, .7),
700: const Color.fromRGBO(110, 54, 120, .8),
800: const Color.fromRGBO(110, 54, 120, .9),
900: const Color.fromRGBO(110, 54, 120, 1),
};
final MaterialColor taxiPrimaryMaterialColor =
MaterialColor(0xFF6E3678, primaryColor1);
const Color taxiPrimaryColor = Color(0xFF6E3678);
const Color taxiMainBackgroundColor = Colors.white;
const Color toastBackgroundColor = Colors.white;
const Color toastTextColor = Colors.black;
const Color notiColor = Color(0x66C8C8C8);
final Color dialogBarrierColor = Colors.black.withOpacity(0.6);

const defaultDialogButtonSize = Size(128, 43);

const defaultDialogButtonInnerPadding = EdgeInsets.only(top: 9, bottom: 10);

final defaultDialogButtonBorderRadius = BorderRadius.circular(8.0);

final defaultTaxiMarginDouble = 20.0;

final defaultTaxiMargin =
EdgeInsets.symmetric(horizontal: defaultTaxiMarginDouble);

final defaultNotificationButtonSize = const Size(88, 24);
const defaultNotificationButtonInnerPadding =
EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0);
final defaultNotificationButtonBorderRadius = BorderRadius.circular(30.0);

ThemeData taxiTheme() {
final base = ThemeData(
primarySwatch: taxiPrimaryMaterialColor,
primaryColor: const Color(0xFF6E3678),

//dialog 테마
dialogTheme: DialogTheme(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
backgroundColor: Colors.white,
actionsPadding: const EdgeInsets.all(10.0),
surfaceTintColor: Colors.black,
),
dialogBackgroundColor: Colors.white,

//dialog 버튼
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
elevation: 0.5,
fixedSize: defaultDialogButtonSize,
padding: defaultDialogButtonInnerPadding,
backgroundColor: const Color.fromARGB(255, 238, 238, 238),
shape: RoundedRectangleBorder(
borderRadius: defaultDialogButtonBorderRadius,
),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
fixedSize: defaultDialogButtonSize,
padding: defaultDialogButtonInnerPadding,
backgroundColor: taxiPrimaryMaterialColor,
shape: RoundedRectangleBorder(
borderRadius: defaultDialogButtonBorderRadius,
side: const BorderSide(color: Colors.black),
),
),
),
bannerTheme: MaterialBannerThemeData(
backgroundColor: Colors.white,
),

//텍스트 테마
textTheme: TextTheme(
//Dialog 제목
titleSmall: GoogleFonts.roboto(
textStyle: const TextStyle(
color: Color(0xFF323232),
fontSize: 16,
fontWeight: FontWeight.normal)),

//Dialog 상세 설명
bodySmall: GoogleFonts.roboto(
textStyle: const TextStyle(
color: Color(0xFF888888),
fontSize: 10,
fontWeight: FontWeight.bold)),

//Dialog Elevated 버튼 텍스트
labelLarge: GoogleFonts.roboto(
textStyle: const TextStyle(
color: Color(0xFFEEEEEE),
fontSize: 14,
fontWeight: FontWeight.bold)),

//Dialog Elevated 버튼 텍스트
labelMedium: GoogleFonts.roboto(
textStyle: const TextStyle(
color: Color.fromARGB(255, 129, 129, 129),
fontSize: 14,
fontWeight: FontWeight.normal)),
labelSmall: GoogleFonts.roboto(
textStyle: const TextStyle(
color: Color(0xFFEEEEEE),
fontSize: 12,
fontWeight: FontWeight.w700,
letterSpacing: 0.4,
)),
),

bottomNavigationBarTheme: BottomNavigationBarThemeData(
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.white,
selectedItemColor: Color(0xFF6E3678),
),
);
return base;
}
90 changes: 90 additions & 0 deletions lib/views/taxiNotification.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import "package:flutter/material.dart";

import 'package:taxi_flutter_app/constants/theme.dart';

class TaxiNotification extends StatelessWidget {
TaxiNotification(
{super.key,
required this.title,
required this.subTitle,
required this.content,
required this.button,
required this.imageUrl});
late final String title;
late final String subTitle;
late final String content;
late final Map<String, Uri> button;
late final Uri imageUrl;

@override
Widget build(BuildContext context) {
return Stack(children: [
MaterialBanner(
leadingPadding: const EdgeInsets.only(right: 20),
forceActionsBelow: true,
padding: EdgeInsets.only(
left: 20, right: 20, top: MediaQuery.of(context).padding.top + 20),
content: Column(
mainAxisAlignment: MainAxisAlignment.start,
verticalDirection: VerticalDirection.down,
textBaseline: TextBaseline.alphabetic,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: title,
style: Theme.of(context).textTheme.bodySmall,
),
TextSpan(
text: " / " + subTitle,
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(fontWeight: FontWeight.w400)),
],
),
),
const SizedBox(height: 5),
Text(
content,
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: Colors.black,
fontSize: 12,
fontWeight: FontWeight.w400),
),
],
),
leading:
Image(image: NetworkImage("https://via.placeholder.com/40x40")),
backgroundColor: Colors.white,
actions: <Widget>[
Positioned(
bottom: 20,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
fixedSize: defaultNotificationButtonSize,
padding: defaultNotificationButtonInnerPadding,
backgroundColor: taxiPrimaryMaterialColor,
shape: RoundedRectangleBorder(
borderRadius: defaultNotificationButtonBorderRadius,
side: const BorderSide(color: Colors.black),
),
),
child: Text(button.keys.first,
style: Theme.of(context).textTheme.labelSmall),
onPressed: () {}),
),
],
),
Positioned(
top: MediaQuery.of(context).padding.top,
child: Container(
width: 430,
height: 5,
color: taxiPrimaryColor,
))
]);
}
}

0 comments on commit 369ffa4

Please sign in to comment.