Skip to content

Commit 0688bbd

Browse files
Merge pull request #3 from AhmedAbdoElhawary/feature/initial-branch
Feature/initial branch
2 parents 938ce14 + 42f2aeb commit 0688bbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3212
-189
lines changed

lib/config/routes/route_app.dart

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import 'package:algorithm_visualizer/core/helpers/app_bar/app_bar.dart';
2+
import 'package:algorithm_visualizer/core/resources/strings_manager.dart';
3+
import 'package:algorithm_visualizer/core/widgets/adaptive/text/adaptive_text.dart';
4+
import 'package:algorithm_visualizer/features/grid/view/grid_page.dart';
5+
import 'package:flutter/material.dart';
6+
import 'package:go_router/go_router.dart';
7+
8+
class Routes {
9+
static const RouteConfig grid = RouteConfig(
10+
name: 'grid',
11+
path: '/',
12+
);
13+
14+
// name: 'hashtag',
15+
// path: '/hashtag/:hashtagId',
16+
// pathParamsName: "hashtagId",
17+
// queryParamsName: 'mid',
18+
}
19+
20+
class RouteConfig {
21+
final String name;
22+
final String path;
23+
final String pathParamsName;
24+
final String queryParamsName;
25+
26+
const RouteConfig({
27+
required this.name,
28+
required this.path,
29+
this.pathParamsName = "",
30+
this.queryParamsName = "",
31+
});
32+
}
33+
34+
class AppRoutes {
35+
static final router = GoRouter(
36+
debugLogDiagnostics: true,
37+
initialLocation: Routes.grid.path,
38+
errorBuilder: (context, state) => const _UnknownPage(),
39+
routes: [
40+
ShellRoute(
41+
builder: (context, state, child) {
42+
return child;
43+
},
44+
routes: [
45+
GoRoute(
46+
path: Routes.grid.path,
47+
name: Routes.grid.name,
48+
builder: (context, state) => const GridPage(),
49+
),
50+
],
51+
),
52+
53+
///------------------------------------------------------------>
54+
],
55+
);
56+
}
57+
58+
class _UnknownPage extends StatelessWidget {
59+
const _UnknownPage();
60+
61+
@override
62+
Widget build(BuildContext context) {
63+
return Scaffold(
64+
appBar: GlobalAppBar(),
65+
body: const Center(child: RegularText(StringsManager.unknownPage)),
66+
);
67+
}
68+
}

lib/config/themes/app_theme.dart

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_screenutil/flutter_screenutil.dart';
3+
import 'package:algorithm_visualizer/core/resources/color_manager.dart';
4+
import 'package:algorithm_visualizer/core/resources/font_manager.dart';
5+
import 'package:algorithm_visualizer/core/resources/styles_manager.dart';
6+
7+
class AppTheme {
8+
static ThemeData get light {
9+
return ThemeData(
10+
useMaterial3: true,
11+
fontFamily: FontConstants.fontFamily,
12+
visualDensity: VisualDensity.adaptivePlatformDensity,
13+
primaryColor: ColorManager.white,
14+
primaryColorLight: ColorManager.whiteD2,
15+
hintColor: ColorManager.greyD4,
16+
shadowColor: ColorManager.blackOp10,
17+
focusColor: ColorManager.black,
18+
disabledColor: ColorManager.blackOp50,
19+
switchTheme: const SwitchThemeData(),
20+
dialogBackgroundColor: ColorManager.whiteD1,
21+
hoverColor: ColorManager.blackOp50,
22+
indicatorColor: ColorManager.blackOp40,
23+
highlightColor: ColorManager.whiteD3,
24+
bottomSheetTheme: const BottomSheetThemeData(
25+
backgroundColor: ColorManager.white,
26+
surfaceTintColor: ColorManager.white,
27+
shadowColor: ColorManager.white,
28+
),
29+
dialogTheme: const DialogTheme(surfaceTintColor: ColorManager.whiteD5),
30+
dividerColor: ColorManager.blackOp10,
31+
scaffoldBackgroundColor: ColorManager.white,
32+
iconTheme: const IconThemeData(color: ColorManager.black),
33+
outlinedButtonTheme: _outlinedButtonTheme(),
34+
elevatedButtonTheme: _elevatedButtonThemeData(),
35+
textButtonTheme: const TextButtonThemeData(
36+
style: ButtonStyle(
37+
overlayColor: WidgetStatePropertyAll(
38+
ColorManager.whiteD3,
39+
),
40+
)),
41+
chipTheme: const ChipThemeData(backgroundColor: ColorManager.blackOp10),
42+
canvasColor: ColorManager.transparent,
43+
splashColor: ColorManager.white,
44+
appBarTheme: _appBarTheme(),
45+
tabBarTheme: _tabBarTheme(),
46+
textTheme: _textTheme(),
47+
dividerTheme: const DividerThemeData(color: ColorManager.whiteD5),
48+
bottomAppBarTheme: const BottomAppBarTheme(color: ColorManager.blackOp30),
49+
textSelectionTheme: const TextSelectionThemeData(
50+
cursorColor: ColorManager.teal,
51+
selectionColor: ColorManager.blackOp10,
52+
selectionHandleColor: ColorManager.black,
53+
),
54+
listTileTheme: const ListTileThemeData(),
55+
colorScheme: const ColorScheme.highContrastLight(
56+
// circle avatar color
57+
primaryContainer: ColorManager.whiteD4,
58+
surface: ColorManager.whiteD3,
59+
)
60+
.copyWith(surface: ColorManager.whiteD5)
61+
.copyWith(error: ColorManager.black),
62+
);
63+
}
64+
65+
static ElevatedButtonThemeData _elevatedButtonThemeData() {
66+
return ElevatedButtonThemeData(
67+
style: ButtonStyle(
68+
fixedSize: WidgetStateProperty.all<Size>(Size(double.maxFinite, 45.r)),
69+
backgroundColor: WidgetStateProperty.resolveWith<Color?>(
70+
(_) => ColorManager.whiteD2),
71+
overlayColor: WidgetStateProperty.resolveWith<Color?>(
72+
(_) => ColorManager.whiteOp20),
73+
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
74+
const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
75+
),
76+
),
77+
);
78+
}
79+
80+
static OutlinedButtonThemeData _outlinedButtonTheme() {
81+
return OutlinedButtonThemeData(
82+
style: OutlinedButton.styleFrom(
83+
fixedSize: Size(double.maxFinite, 45.r),
84+
shape:
85+
RoundedRectangleBorder(borderRadius: BorderRadius.circular(50.r)),
86+
side: BorderSide(width: 1.r, color: ColorManager.whiteD5),
87+
),
88+
);
89+
}
90+
91+
static TabBarTheme _tabBarTheme() {
92+
return TabBarTheme(
93+
indicatorSize: TabBarIndicatorSize.label,
94+
labelPadding: EdgeInsets.zero,
95+
indicator: BoxDecoration(
96+
border: Border(
97+
bottom: BorderSide(color: ColorManager.black, width: 1.5.r),
98+
),
99+
),
100+
labelColor: ColorManager.black,
101+
unselectedLabelColor: ColorManager.grey,
102+
);
103+
}
104+
105+
static TextTheme _textTheme() {
106+
return TextTheme(
107+
bodyLarge: _getStyle(const GetRegularStyle(color: ColorManager.greyD4)),
108+
bodyMedium: _getStyle(
109+
const GetRegularStyle(color: ColorManager.greyD5, fontSize: 12)),
110+
bodySmall: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
111+
titleSmall: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
112+
labelSmall: _getStyle(const GetMediumStyle(color: ColorManager.greyD2)),
113+
displaySmall: _getStyle(const GetMediumStyle(color: ColorManager.greyD2)),
114+
displayLarge: _getStyle(const GetMediumStyle(color: ColorManager.grey)),
115+
displayMedium: _getStyle(const GetMediumStyle(color: ColorManager.grey)),
116+
headlineLarge:
117+
_getStyle(const GetRegularStyle(color: ColorManager.whiteD3)),
118+
headlineMedium:
119+
_getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
120+
headlineSmall:
121+
_getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
122+
labelLarge: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
123+
labelMedium: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
124+
titleLarge: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
125+
titleMedium: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
126+
);
127+
}
128+
129+
static TextStyle _getStyle(TextStyle style) {
130+
return style;
131+
}
132+
133+
static AppBarTheme _appBarTheme() {
134+
return AppBarTheme(
135+
elevation: 0,
136+
titleSpacing: 5.w,
137+
surfaceTintColor: ColorManager.white,
138+
color: ColorManager.white,
139+
shadowColor: ColorManager.blackOp20,
140+
scrolledUnderElevation: 1.5.r,
141+
iconTheme: const IconThemeData(color: ColorManager.black),
142+
titleTextStyle: const GetRegularStyle(
143+
fontSize: 16, color: ColorManager.black),
144+
);
145+
}
146+
147+
static ThemeData get dark {
148+
return ThemeData(
149+
useMaterial3: true,
150+
fontFamily: FontConstants.fontFamily,
151+
visualDensity: VisualDensity.adaptivePlatformDensity,
152+
primaryColor: ColorManager.blackBlue,
153+
primaryColorLight: ColorManager.blackL2,
154+
hintColor: ColorManager.greyD4,
155+
shadowColor: ColorManager.whiteOp10,
156+
focusColor: ColorManager.white,
157+
disabledColor: ColorManager.whiteOp50,
158+
dialogBackgroundColor: ColorManager.blackL1,
159+
hoverColor: ColorManager.whiteOp50,
160+
indicatorColor: ColorManager.whiteOp40,
161+
highlightColor: ColorManager.blackL3Blue,
162+
bottomSheetTheme: const BottomSheetThemeData(
163+
backgroundColor: ColorManager.blackL5,
164+
surfaceTintColor: ColorManager.blackL5,
165+
shadowColor: ColorManager.blackL5,
166+
),
167+
dialogTheme: const DialogTheme(surfaceTintColor: ColorManager.blackL5),
168+
dividerColor: ColorManager.whiteOp10,
169+
scaffoldBackgroundColor: ColorManager.blackBlue,
170+
iconTheme: const IconThemeData(color: ColorManager.white),
171+
outlinedButtonTheme: _outlinedButtonDarkTheme(),
172+
elevatedButtonTheme: _elevatedButtonDarkThemeData(),
173+
textButtonTheme: const TextButtonThemeData(
174+
style: ButtonStyle(
175+
overlayColor: WidgetStatePropertyAll(ColorManager.blackL3Blue),
176+
),
177+
),
178+
chipTheme: const ChipThemeData(backgroundColor: ColorManager.whiteOp10),
179+
canvasColor: ColorManager.transparent,
180+
splashColor: ColorManager.blackBlue,
181+
appBarTheme: _appBarDarkTheme(),
182+
tabBarTheme: _tabBarDarkTheme(),
183+
textTheme: _textDarkTheme(),
184+
dividerTheme: const DividerThemeData(color: ColorManager.blackL5),
185+
bottomAppBarTheme: const BottomAppBarTheme(color: ColorManager.whiteOp30),
186+
textSelectionTheme: const TextSelectionThemeData(
187+
cursorColor: ColorManager.teal,
188+
selectionColor: ColorManager.greyD6,
189+
selectionHandleColor: ColorManager.white,
190+
),
191+
colorScheme: const ColorScheme.highContrastDark(
192+
primaryContainer: ColorManager.blackL4,
193+
surface: ColorManager.blackL6,
194+
)
195+
.copyWith(surface: ColorManager.blackL6)
196+
.copyWith(error: ColorManager.white),
197+
);
198+
}
199+
200+
static ElevatedButtonThemeData _elevatedButtonDarkThemeData() {
201+
return ElevatedButtonThemeData(
202+
style: ButtonStyle(
203+
fixedSize: WidgetStateProperty.all<Size>(Size(double.maxFinite, 45.r)),
204+
backgroundColor: WidgetStateProperty.resolveWith<Color?>(
205+
(_) => ColorManager.blackL2),
206+
overlayColor: WidgetStateProperty.resolveWith<Color?>(
207+
(_) => ColorManager.blackOp20),
208+
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
209+
const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
210+
),
211+
),
212+
);
213+
}
214+
215+
static OutlinedButtonThemeData _outlinedButtonDarkTheme() {
216+
return OutlinedButtonThemeData(
217+
style: OutlinedButton.styleFrom(
218+
fixedSize: Size(double.maxFinite, 45.r),
219+
shape:
220+
RoundedRectangleBorder(borderRadius: BorderRadius.circular(50.r)),
221+
side: BorderSide(width: 1.r, color: ColorManager.whiteD5),
222+
),
223+
);
224+
}
225+
226+
static TabBarTheme _tabBarDarkTheme() {
227+
return TabBarTheme(
228+
indicatorSize: TabBarIndicatorSize.label,
229+
labelPadding: EdgeInsets.zero,
230+
indicator: BoxDecoration(
231+
border: Border(
232+
bottom: BorderSide(color: ColorManager.white, width: 1.5.r),
233+
),
234+
),
235+
labelColor: ColorManager.white,
236+
unselectedLabelColor: ColorManager.grey,
237+
);
238+
}
239+
240+
static TextTheme _textDarkTheme() {
241+
return TextTheme(
242+
bodyLarge: _getStyle(const GetRegularStyle(color: ColorManager.greyD1)),
243+
bodyMedium: _getStyle(
244+
const GetRegularStyle(color: ColorManager.grey, fontSize: 12)),
245+
bodySmall: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
246+
titleSmall: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
247+
labelSmall: _getStyle(const GetMediumStyle(color: ColorManager.greyD2)),
248+
displaySmall: _getStyle(const GetMediumStyle(color: ColorManager.greyD2)),
249+
displayLarge: _getStyle(const GetMediumStyle(color: ColorManager.grey)),
250+
displayMedium: _getStyle(const GetMediumStyle(color: ColorManager.grey)),
251+
headlineLarge:
252+
_getStyle(const GetRegularStyle(color: ColorManager.blackL3Blue)),
253+
headlineMedium:
254+
_getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
255+
headlineSmall:
256+
_getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
257+
labelLarge: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
258+
labelMedium: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
259+
titleLarge: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
260+
titleMedium: _getStyle(const GetRegularStyle(color: ColorManager.greyD2)),
261+
);
262+
}
263+
264+
static AppBarTheme _appBarDarkTheme() {
265+
return AppBarTheme(
266+
elevation: 0,
267+
titleSpacing: 5.w,
268+
surfaceTintColor: ColorManager.blackBlue,
269+
color: ColorManager.blackBlue,
270+
shadowColor: ColorManager.greyD8,
271+
scrolledUnderElevation: 1.5.r,
272+
iconTheme: const IconThemeData(color: ColorManager.white),
273+
titleTextStyle: const GetRegularStyle(
274+
fontSize:16, color: ColorManager.white),
275+
);
276+
}
277+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
enum LanguagesEnum { english, arabic }

lib/core/extensions/language.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'package:algorithm_visualizer/core/enums/app_settings_enum.dart';
2+
3+
extension LanguagesKeys on LanguagesEnum {
4+
String get shortKey => _keys[this] ?? "en";
5+
String get shortKeyWithCounty => _keysWithCountry[this] ?? "en_us";
6+
7+
Map<LanguagesEnum, String> get _keys => {
8+
LanguagesEnum.english: "en",
9+
LanguagesEnum.arabic: "ar",
10+
};
11+
Map<LanguagesEnum, String> get _keysWithCountry => {
12+
LanguagesEnum.english: "en_us",
13+
LanguagesEnum.arabic: "ar_sa",
14+
};
15+
}
16+
17+
extension LanguagesString on String {
18+
LanguagesEnum get language => _keys[this] ?? LanguagesEnum.english;
19+
20+
Map<String, LanguagesEnum> get _keys => {
21+
"en": LanguagesEnum.english,
22+
"ar": LanguagesEnum.arabic,
23+
};
24+
}

0 commit comments

Comments
 (0)