Skip to content

Commit

Permalink
Merge pull request #65 from Prayas-Agrawal/migration
Browse files Browse the repository at this point in the history
Migration to flutter 3
  • Loading branch information
HariRags authored Aug 31, 2024
2 parents bf50ee3 + cb7383e commit 5d49dfd
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 90 deletions.
83 changes: 54 additions & 29 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import 'package:uni_links/uni_links.dart';
void main() async {
GlobalKey<MyAppState> key = GlobalKey();
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
await Firebase.initializeApp( );
InstiAppBloc bloc = InstiAppBloc(wholeAppKey: key);
FirebaseMessaging.onBackgroundMessage(sendMessage);
await dotenv.load(fileName: ".env");
Expand Down Expand Up @@ -155,7 +155,7 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
theme: ThemeData(
// fontFamily: "SourceSansPro",
fontFamily: "IBMPlexSans",

useMaterial3: false,
primaryColor: widget.bloc.primaryColor,
colorScheme: theme.colorScheme.copyWith(
primary: widget.bloc.primaryColor,
Expand All @@ -166,9 +166,10 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
surface: widget.bloc.brightness == AppBrightness.light
? Colors.white
: widget.bloc.brightness.toColor(),
surfaceContainerHighest: widget.bloc.brightness == AppBrightness.light
? Color(0xFFE8ECF2)
: Color(0xFF121212),
surfaceContainerHighest:
widget.bloc.brightness == AppBrightness.light
? Color(0xFFE8ECF2)
: Color(0xFF121212),
onSurface: widget.bloc.brightness == AppBrightness.light
? Colors.black
: Colors.white,
Expand Down Expand Up @@ -208,30 +209,54 @@ class MyAppState extends State<MyApp> with WidgetsBindingObserver {
? Colors.black
: Colors.white,
),
headlineSmall: TextStyle()), checkboxTheme: CheckboxThemeData(
fillColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) { return null; }
if (states.contains(WidgetState.selected)) { return widget.bloc.accentColor; }
return null;
}),
), radioTheme: RadioThemeData(
fillColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) { return null; }
if (states.contains(WidgetState.selected)) { return widget.bloc.accentColor; }
return null;
}),
), switchTheme: SwitchThemeData(
thumbColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) { return null; }
if (states.contains(WidgetState.selected)) { return widget.bloc.accentColor; }
return null;
}),
trackColor: WidgetStateProperty.resolveWith<Color?>((Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) { return null; }
if (states.contains(WidgetState.selected)) { return widget.bloc.accentColor; }
return null;
}),
), bottomAppBarTheme: BottomAppBarTheme(color: widget.bloc.primaryColor),
headlineSmall: TextStyle()),
checkboxTheme: CheckboxThemeData(
fillColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return null;
}
if (states.contains(WidgetState.selected)) {
return widget.bloc.accentColor;
}
return null;
}),
),
radioTheme: RadioThemeData(
fillColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return null;
}
if (states.contains(WidgetState.selected)) {
return widget.bloc.accentColor;
}
return null;
}),
),
switchTheme: SwitchThemeData(
thumbColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return null;
}
if (states.contains(WidgetState.selected)) {
return widget.bloc.accentColor;
}
return null;
}),
trackColor: WidgetStateProperty.resolveWith<Color?>(
(Set<WidgetState> states) {
if (states.contains(WidgetState.disabled)) {
return null;
}
if (states.contains(WidgetState.selected)) {
return widget.bloc.accentColor;
}
return null;
}),
),
bottomAppBarTheme: BottomAppBarTheme(color: widget.bloc.primaryColor),
),
onGenerateRoute: (RouteSettings settings) {
// print(settings.name);
Expand Down
130 changes: 70 additions & 60 deletions lib/src/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,71 +96,81 @@ class _NavDrawerState extends State<NavDrawer> {
highlight: indexSnapshot.data == 2,
selected: indexSnapshot.data == 2,
),
3: NavExpansionTile(
title: "Mess",
leading: Icons.restaurant_outlined,
initiallyExpanded:
indexSnapshot.data == 3 || indexSnapshot.data == 14,
3: Column(
children: [
NavListTile(
icon: Icons.restaurant_outlined,
title: "Mess Menu",
onTap: () {
changeSelection(3, drawerState!);
navigateNamed('/mess');
},
highlight: indexSnapshot.data == 3,
selected: indexSnapshot.data == 3,
),
NavListTile(
icon: Icons.restaurant_outlined,
title: "Take your meal",
onTap: () {
changeSelection(3, drawerState!);
navigateNamed('/messcalendar/qr');
},
highlight: indexSnapshot.data == 14,
selected: indexSnapshot.data == 14,
),
Divider(),
NavExpansionTile(
title: "Mess",
leading: Icons.restaurant_outlined,
initiallyExpanded: indexSnapshot.data == 3 ||
indexSnapshot.data == 14,
children: [
NavListTile(
icon: Icons.restaurant_outlined,
title: "Mess Menu",
onTap: () {
changeSelection(3, drawerState!);
navigateNamed('/mess');
},
highlight: indexSnapshot.data == 3,
selected: indexSnapshot.data == 3,
),
NavListTile(
icon: Icons.restaurant_outlined,
title: "Take your meal",
onTap: () {
changeSelection(3, drawerState!);
navigateNamed('/messcalendar/qr');
},
highlight: indexSnapshot.data == 14,
selected: indexSnapshot.data == 14,
),
],
)
],
),
4: NavExpansionTile(
leading: Icons.work_outline,
title: "Blogs",
initiallyExpanded: indexSnapshot.data! <= 6 &&
indexSnapshot.data! >= 4,
4: Column(
children: [
NavListTile(
icon: Icons.work_outline,
title: "Placement Blog",
onTap: () {
changeSelection(4, drawerState!);
navigateNamed('/placeblog');
},
highlight: indexSnapshot.data == 4,
selected: indexSnapshot.data == 4,
),
NavListTile(
icon: Icons.work_outline,
title: "Internship Blog",
onTap: () {
changeSelection(5, drawerState!);
navigateNamed('/trainblog');
},
highlight: indexSnapshot.data == 5,
selected: indexSnapshot.data == 5,
),
NavListTile(
// key: Key((indexSnapshot.data == 6).toString()),
icon: Icons.work_outline,
title: "External Blog",
onTap: () {
changeSelection(6, drawerState!);
navigateNamed('/externalblog');
},
highlight: indexSnapshot.data == 6,
selected: indexSnapshot.data == 6,
NavExpansionTile(
leading: Icons.work_outline,
title: "Blogs",
initiallyExpanded: indexSnapshot.data! <= 6 &&
indexSnapshot.data! >= 4,
children: [
NavListTile(
icon: Icons.work_outline,
title: "Placement Blog",
onTap: () {
changeSelection(4, drawerState!);
navigateNamed('/placeblog');
},
highlight: indexSnapshot.data == 4,
selected: indexSnapshot.data == 4,
),
NavListTile(
icon: Icons.work_outline,
title: "Internship Blog",
onTap: () {
changeSelection(5, drawerState!);
navigateNamed('/trainblog');
},
highlight: indexSnapshot.data == 5,
selected: indexSnapshot.data == 5,
),
NavListTile(
// key: Key((indexSnapshot.data == 6).toString()),
icon: Icons.work_outline,
title: "External Blog",
onTap: () {
changeSelection(6, drawerState!);
navigateNamed('/externalblog');
},
highlight: indexSnapshot.data == 6,
selected: indexSnapshot.data == 6,
),
],
),
Divider(),
],
),
15: NavListTile(
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ dev_dependencies:
# The following section is specific to Flutter.
flutter:
assets:
- .env
- .env.dev
- assets/
- assets/login/
- assets/map/
Expand All @@ -94,7 +96,6 @@ flutter:
- assets/map/assets/
- assets/map/assets/map/
- assets/buynsell/
- .env
fonts:
- family: IBMPlexSans
fonts:
Expand Down

0 comments on commit 5d49dfd

Please sign in to comment.