Skip to content

Commit 49f74d7

Browse files
committed
add: navigator
1 parent 4d8f529 commit 49f74d7

25 files changed

+509
-507
lines changed

assets/images/theme/moon.png

1.56 KB
Loading

assets/images/theme/sun.png

1.47 KB
Loading

lib/config/app_theme.dart

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,75 +11,76 @@ class AppTheme {
1111

1212
return ThemeData(
1313
brightness: Brightness.light,
14+
fontFamily: GoogleFonts.abel().fontFamily,
1415
primaryColor: const Color(0xFF8E97FD),
1516
primaryColorDark: const Color(0xFF3F414E),
1617
primaryColorLight: Colors.white,
1718
dividerTheme: DividerThemeData(color: secondaryTextColor),
1819
textTheme: TextTheme(
19-
displayLarge: GoogleFonts.abel(
20+
displayLarge: TextStyle(
2021
fontSize: 57, // Display terbesar untuk teks utama atau header besar
2122
color: primaryTextColor,
2223
fontWeight: FontWeight.w300,
2324
),
24-
displayMedium: GoogleFonts.abel(
25+
displayMedium: TextStyle(
2526
fontSize:
2627
45, // Display sedang, digunakan untuk header besar namun tidak dominan
2728
color: primaryTextColor,
2829
fontWeight: FontWeight.w300,
2930
),
30-
displaySmall: GoogleFonts.abel(
31+
displaySmall: TextStyle(
3132
fontSize: 36, // Display kecil, untuk sub-header atau judul penting
3233
color: primaryTextColor,
3334
fontWeight: FontWeight.bold,
3435
),
35-
headlineLarge: GoogleFonts.abel(
36+
headlineLarge: TextStyle(
3637
fontSize: 32, // Ukuran untuk headline atau judul utama
3738
color: secondaryTextColor,
3839
),
39-
headlineMedium: GoogleFonts.abel(
40+
headlineMedium: TextStyle(
4041
fontSize: 28, // Ukuran headline menengah
4142
color: primaryTextColor,
4243
),
43-
headlineSmall: GoogleFonts.abel(
44+
headlineSmall: TextStyle(
4445
fontSize: 24, // Ukuran headline kecil
4546
color: primaryTextColor,
4647
),
47-
titleLarge: GoogleFonts.abel(
48+
titleLarge: TextStyle(
4849
fontSize: 22, // Ukuran besar untuk judul utama di layar
4950
color: secondaryTextColor,
5051
),
51-
titleMedium: GoogleFonts.abel(
52+
titleMedium: TextStyle(
5253
fontSize: 18, // Ukuran sedang untuk judul atau subtitle
5354
color: primaryTextColor,
5455
fontWeight: FontWeight.bold,
5556
),
56-
titleSmall: GoogleFonts.abel(
57+
titleSmall: TextStyle(
5758
fontSize: 14, // Ukuran kecil untuk subtitle atau label
5859
color: secondaryTextColor,
5960
fontWeight: FontWeight.w300,
6061
),
61-
bodyLarge: GoogleFonts.abel(
62+
bodyLarge: TextStyle(
6263
fontSize: 16, // Ukuran teks utama
6364
color: primaryTextColor,
6465
),
65-
bodyMedium: GoogleFonts.abel(
66+
bodyMedium: TextStyle(
6667
fontSize: 14, // Ukuran teks sekunder
6768
color: primaryTextColor,
6869
),
69-
bodySmall: GoogleFonts.abel(
70+
bodySmall: TextStyle(
7071
fontSize: 12, // Ukuran untuk teks tambahan atau catatan
7172
color: secondaryTextColor,
7273
),
73-
labelLarge: GoogleFonts.abel(
74+
labelLarge: TextStyle(
7475
fontSize:
7576
14, // Label besar, digunakan untuk tombol atau label penting
7677
color: secondaryTextColor,
7778
),
78-
labelMedium: GoogleFonts.abel(
79+
labelMedium: TextStyle(
7980
fontSize: 12, // Label sedang untuk UI elemen
8081
color: secondaryTextColor,
8182
),
82-
labelSmall: GoogleFonts.abel(
83+
labelSmall: TextStyle(
8384
fontSize: 11, // Label kecil, digunakan untuk indikator atau ikon
8485
color: secondaryTextColor,
8586
),
@@ -94,6 +95,7 @@ class AppTheme {
9495

9596
return ThemeData(
9697
brightness: Brightness.dark,
98+
fontFamily: GoogleFonts.abel().fontFamily,
9799
scaffoldBackgroundColor: const Color(0xFF02174C),
98100
primaryColor: const Color(0xFF8E97FD),
99101
primaryColorDark: const Color(0xFFE6E7F2),
@@ -103,70 +105,70 @@ class AppTheme {
103105
backgroundColor: Color(0xFF03174D), // Warna background untuk mode gelap
104106
),
105107
textTheme: TextTheme(
106-
displayLarge: GoogleFonts.abel(
108+
displayLarge: TextStyle(
107109
fontSize: 57, // Display terbesar untuk teks utama atau header besar
108110
color: primaryTextColor,
109111
fontWeight: FontWeight.w300,
110112
),
111-
displayMedium: GoogleFonts.abel(
113+
displayMedium: TextStyle(
112114
fontSize:
113115
45, // Display sedang, digunakan untuk header besar namun tidak dominan
114116
color: primaryTextColor,
115117
fontWeight: FontWeight.w300,
116118
),
117-
displaySmall: GoogleFonts.abel(
119+
displaySmall: TextStyle(
118120
fontSize: 36, // Display kecil, untuk sub-header atau judul penting
119121
color: primaryTextColor,
120122
fontWeight: FontWeight.bold,
121123
),
122-
headlineLarge: GoogleFonts.abel(
124+
headlineLarge: TextStyle(
123125
fontSize: 32, // Ukuran untuk headline atau judul utama
124126
color: secondaryTextColor,
125127
),
126-
headlineMedium: GoogleFonts.abel(
128+
headlineMedium: TextStyle(
127129
fontSize: 28, // Ukuran headline menengah
128130
color: primaryTextColor,
129131
),
130-
headlineSmall: GoogleFonts.abel(
132+
headlineSmall: TextStyle(
131133
fontSize: 24, // Ukuran headline kecil
132134
color: primaryTextColor,
133135
),
134-
titleLarge: GoogleFonts.abel(
136+
titleLarge: TextStyle(
135137
fontSize: 22, // Ukuran besar untuk judul utama di layar
136138
color: secondaryTextColor,
137139
),
138-
titleMedium: GoogleFonts.abel(
140+
titleMedium: TextStyle(
139141
fontSize: 18, // Ukuran sedang untuk judul atau subtitle
140142
color: primaryTextColor,
141143
fontWeight: FontWeight.bold,
142144
),
143-
titleSmall: GoogleFonts.abel(
145+
titleSmall: TextStyle(
144146
fontSize: 14, // Ukuran kecil untuk subtitle atau label
145147
color: secondaryTextColor,
146148
fontWeight: FontWeight.w300,
147149
),
148-
bodyLarge: GoogleFonts.abel(
150+
bodyLarge: TextStyle(
149151
fontSize: 16, // Ukuran teks utama
150152
color: primaryTextColor,
151153
),
152-
bodyMedium: GoogleFonts.abel(
154+
bodyMedium: TextStyle(
153155
fontSize: 14, // Ukuran teks sekunder
154156
color: primaryTextColor,
155157
),
156-
bodySmall: GoogleFonts.abel(
158+
bodySmall: TextStyle(
157159
fontSize: 12, // Ukuran untuk teks tambahan atau catatan
158160
color: secondaryTextColor,
159161
),
160-
labelLarge: GoogleFonts.abel(
162+
labelLarge: TextStyle(
161163
fontSize:
162164
14, // Label besar, digunakan untuk tombol atau label penting
163165
color: secondaryTextColor,
164166
),
165-
labelMedium: GoogleFonts.abel(
167+
labelMedium: TextStyle(
166168
fontSize: 12, // Label sedang untuk UI elemen
167169
color: secondaryTextColor,
168170
),
169-
labelSmall: GoogleFonts.abel(
171+
labelSmall: TextStyle(
170172
fontSize: 11, // Label kecil, digunakan untuk indikator atau ikon
171173
color: secondaryTextColor,
172174
),

lib/config/routes.dart

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import 'package:flutter/material.dart';
2+
import '../screen/screen.dart';
3+
4+
class Routes {
5+
static const String signUp = '/sign_up';
6+
static const String signIn = '/sign_in';
7+
static const String chooseTopic = '/choose_topic';
8+
static const String reminders = '/reminders';
9+
static const String menu = '/menu';
10+
static const String playOption = '/play_option';
11+
12+
static Route<dynamic> generateRoute(RouteSettings settings) {
13+
switch (settings.name) {
14+
case signUp:
15+
return MaterialPageRoute(builder: (_) => const SignUpPage());
16+
case signIn:
17+
return MaterialPageRoute(builder: (_) => const SignInPage());
18+
case chooseTopic:
19+
return MaterialPageRoute(builder: (_) => const ChoseTopicPage());
20+
case reminders:
21+
return MaterialPageRoute(builder: (_) => const RemindersPage());
22+
case menu:
23+
return MaterialPageRoute(builder: (_) => const MenuPage());
24+
case playOption:
25+
return MaterialPageRoute(builder: (_) => const PlayOnPage());
26+
case '/':
27+
default:
28+
return MaterialPageRoute(
29+
builder: (_) => Scaffold(
30+
appBar: AppBar(
31+
title: const Text('Routes'),
32+
centerTitle: true, // Judul di tengah
33+
),
34+
body: const Center(
35+
child: Text('Routes Not Found'),
36+
),
37+
));
38+
}
39+
}
40+
}

lib/main.dart

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,82 @@
11
import 'package:flutter/material.dart';
2-
import 'screen/screen.dart';
2+
import 'package:floating_draggable_widget/floating_draggable_widget.dart';
33

4+
import 'config/routes.dart';
5+
import 'screen/screen.dart';
46
import 'config/app_theme.dart';
57

68
void main() {
79
runApp(const MyApp());
810
}
911

10-
class MyApp extends StatelessWidget {
12+
class MyApp extends StatefulWidget {
1113
const MyApp({super.key});
1214

13-
// This widget is the root of your application.
15+
@override
16+
State<MyApp> createState() => _MyAppState();
17+
}
18+
19+
class _MyAppState extends State<MyApp> {
20+
ThemeMode themeMode = ThemeMode.light;
21+
1422
@override
1523
Widget build(BuildContext context) {
1624
return MaterialApp(
17-
title: 'Meditation App UI',
18-
debugShowCheckedModeBanner: false,
19-
theme: AppTheme.lightTheme,
20-
darkTheme: AppTheme.darkTheme,
21-
themeMode: ThemeMode.dark,
22-
home: const MenuPage(),
25+
title: 'Meditation App UI',
26+
debugShowCheckedModeBanner: false,
27+
theme: AppTheme.lightTheme,
28+
darkTheme: AppTheme.darkTheme,
29+
themeMode: themeMode,
30+
builder: (context, child) {
31+
return Stack(
32+
children: [
33+
// Navigator widget
34+
FloatingDraggableWidget(
35+
autoAlign: true,
36+
dx: MediaQuery.of(context).size.width - 60,
37+
dy: 70,
38+
floatingWidget: GestureDetector(
39+
onTap: () {
40+
setState(() {
41+
themeMode = themeMode == ThemeMode.dark
42+
? ThemeMode.light
43+
: ThemeMode.dark;
44+
});
45+
},
46+
child: Image.asset(
47+
themeMode == ThemeMode.dark
48+
? 'assets/images/theme/moon.png'
49+
: 'assets/images/theme/sun.png',
50+
fit: BoxFit.cover,
51+
),
52+
),
53+
floatingWidgetWidth: 60,
54+
floatingWidgetHeight: 60,
55+
mainScreenWidget: child!,
56+
),
57+
],
58+
);
59+
},
60+
home: const SignUpAndSigninPage(),
61+
onGenerateRoute: Routes.generateRoute);
62+
}
63+
}
64+
65+
class SecondPage extends StatelessWidget {
66+
const SecondPage({super.key});
67+
68+
@override
69+
Widget build(BuildContext context) {
70+
return Scaffold(
71+
appBar: AppBar(
72+
title: const Text('Second Page'),
73+
),
74+
body: Center(
75+
child: ElevatedButton(
76+
onPressed: () => Navigator.pop(context),
77+
child: const Text('Back'),
78+
),
79+
),
2380
);
2481
}
2582
}

0 commit comments

Comments
 (0)