Skip to content

Commit

Permalink
Refactor: theme파일 보강 및 dialog 테마 코드 경감
Browse files Browse the repository at this point in the history
  • Loading branch information
ybmin committed Sep 4, 2023
1 parent 46ff779 commit fad9286
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
24 changes: 24 additions & 0 deletions lib/constants/theme.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'constants.dart';
import 'package:google_fonts/google_fonts.dart';

//primaryColor 지정 (색상코드: #6E3647)
Expand All @@ -20,6 +21,29 @@ ThemeData buildTheme() {
final base = ThemeData(
primarySwatch: taxiPrimaryColor,
primaryColor: const Color(0xFF6E3678),
//dialog 버튼
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
elevation: 0.5,
fixedSize: defaultDialogButtonSize,
backgroundColor: Color.fromARGB(255, 238, 238, 238),
shape: RoundedRectangleBorder(
borderRadius: defaultDialogButtonBorderRadius,
),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
fixedSize: defaultDialogButtonSize,
backgroundColor: taxiPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: defaultDialogButtonBorderRadius,
side: const BorderSide(color: Colors.black),
),
),
),

//텍스트 테마
textTheme: TextTheme(
//Dialog 제목
titleMedium: GoogleFonts.roboto(
Expand Down
24 changes: 2 additions & 22 deletions lib/views/taxiDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,7 @@ class TaxiDialog extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0.5,
fixedSize: defaultDialogButtonSize,
backgroundColor: Color.fromARGB(255, 238, 238, 238),
shape: RoundedRectangleBorder(
borderRadius: defaultDialogButtonBorderRadius,
side: const BorderSide(
color: Color.fromARGB(255, 238, 238, 238)),
),
),
style: Theme.of(context).elevatedButtonTheme.style,
child: Text(leftButtonContent,
style: Theme.of(context).textTheme.labelMedium),
onPressed: () async {
Expand All @@ -58,18 +49,7 @@ class TaxiDialog extends StatelessWidget {
7), //피그마 기준 상으로 버튼 간의 간격은 10px이나 모바일 환경상 웹뷰와 같은 간격을 제시하기 위해 7로 설정
),
OutlinedButton(
style: ButtonStyle(
fixedSize:
MaterialStateProperty.all(defaultDialogButtonSize),
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).primaryColor),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: defaultDialogButtonBorderRadius,
side: const BorderSide(color: Colors.black),
),
),
),
style: Theme.of(context).outlinedButtonTheme.style,
child: Text(rightButtonContent,
style: Theme.of(context).textTheme.labelLarge),
onPressed: () async {
Expand Down

0 comments on commit fad9286

Please sign in to comment.