From 59401a3194d13a927e1bdc544de35d61603c47d0 Mon Sep 17 00:00:00 2001 From: Pranil Date: Wed, 23 Aug 2023 23:19:32 +0530 Subject: [PATCH] made ui compliant with --- .../main_screen/widget/card_display.dart | 2 +- .../profile_screen/profile_screen.dart | 321 +++++++++--------- ...der.dart => custom_text_with_divider.dart} | 2 +- .../widgets/profile_text_field.dart | 5 +- lib/services/auth_service.dart | 2 +- lib/services/timetable_service.dart | 2 +- lib/utils/themes.dart | 21 +- 7 files changed, 182 insertions(+), 173 deletions(-) rename lib/screens/profile_screen/widgets/{customTextWithDivider.dart => custom_text_with_divider.dart} (96%) diff --git a/lib/screens/main_screen/widget/card_display.dart b/lib/screens/main_screen/widget/card_display.dart index a7f018bd..2917d42a 100644 --- a/lib/screens/main_screen/widget/card_display.dart +++ b/lib/screens/main_screen/widget/card_display.dart @@ -71,7 +71,7 @@ class _CardDisplayState extends ConsumerState { return const SliverToBoxAdapter( child: Center( child: Text( - "Unable to fetch timetable. Please check if you have entered your details properly.", + "Unable to fetch timetable. Please check if you have entered your details correctly in the profile section.", textAlign: TextAlign.center, ), ), diff --git a/lib/screens/profile_screen/profile_screen.dart b/lib/screens/profile_screen/profile_screen.dart index 6424b1db..35b0c8fb 100644 --- a/lib/screens/profile_screen/profile_screen.dart +++ b/lib/screens/profile_screen/profile_screen.dart @@ -13,7 +13,7 @@ import 'package:image_picker/image_picker.dart'; import 'package:tsec_app/models/student_model/student_model.dart'; import 'package:tsec_app/provider/auth_provider.dart'; import 'package:tsec_app/provider/firebase_provider.dart'; -import 'package:tsec_app/screens/profile_screen/widgets/customTextWithDivider.dart'; +import 'package:tsec_app/screens/profile_screen/widgets/custom_text_with_divider.dart'; import 'package:tsec_app/screens/profile_screen/widgets/profile_screen_appbar.dart'; import 'package:tsec_app/screens/profile_screen/widgets/profile_text_field.dart'; import 'package:tsec_app/widgets/custom_scaffold.dart'; @@ -120,6 +120,8 @@ class _ProfilePageState extends ConsumerState { l = ["A", "B", "C", "D", "E", "F", "G", "H", "I"]; } else if (branch == "Comps") { l = ["C1", "C2", "C3"]; + } else if (branch == "Chem") { + l = ["K"]; } else if (gradyear == "2026") { if (branch == "It" || branch == "Aids") { l = ["S1", "S2"]; @@ -438,12 +440,24 @@ class _ProfilePageState extends ConsumerState { ), Text( data.homeStation ?? "", + // style: Theme.of(context) + // .textTheme + // .headlineSmall + // ?.copyWith( + // color: + // Color.fromARGB(255, 171, 171, 171)), + style: Theme.of(context) .textTheme .headlineSmall ?.copyWith( - color: - Color.fromARGB(255, 171, 171, 171)), + color: + Theme.of(context).colorScheme.onPrimary, + ), + + // style: Theme.of(context).textTheme.headlineSmall + // ?.copyWith( + // color: Theme.of(context).primaryColor), ), const SizedBox( height: 15, @@ -477,9 +491,16 @@ class _ProfilePageState extends ConsumerState { 0.95, padding: EdgeInsets.all(10), decoration: BoxDecoration( - border: - Border.all(color: Color(0xFF454545)), - color: Color(0xFF323232), + // border: + // Border.all(color: Color(0xFF454545)), + border: Border.all( + color: Theme.of(context) + .colorScheme + .outline), + // color: Color(0xFF323232), + color: Theme.of(context) + .colorScheme + .primaryContainer, borderRadius: BorderRadius.circular(30), ), child: Column( @@ -488,58 +509,34 @@ class _ProfilePageState extends ConsumerState { children: [ CustomTextWithDivider( label: "Email", - value: data!.email, + value: data.email, showDivider: true, ), - // Divider( - // thickness: 1, - // color: Colors.grey.shade800, - // ), CustomTextWithDivider( label: "Phone Number", value: data.phoneNum, showDivider: true, ), - // Divider( - // thickness: 1, - // color: Color(0xFF454545), - // ), CustomTextWithDivider( label: "Date of Birth", value: data.dateOfBirth ?? " ", showDivider: true, ), - // Divider( - // thickness: 1, - // color: Color(0xFF454545), - // ), CustomTextWithDivider( label: "Branch", value: data.branch, showDivider: true, ), - // Divider( - // thickness: 1, - // color: Color(0xFF454545), - // ), CustomTextWithDivider( label: "Graduation Year", value: data.gradyear, showDivider: true, ), - // Divider( - // thickness: 1, - // color: Colors.grey.shade800, - // ), CustomTextWithDivider( label: "Division", value: data.div ?? "-", showDivider: true, ), - // Divider( - // thickness: 1, - // color: Colors.grey.shade800, - // ), CustomTextWithDivider( label: "Batch", value: data.batch ?? "-", @@ -554,9 +551,13 @@ class _ProfilePageState extends ConsumerState { 0.95, padding: EdgeInsets.all(10), decoration: BoxDecoration( - border: - Border.all(color: Color(0xFF454545)), - color: Color(0xFF323232), + border: Border.all( + color: Theme.of(context) + .colorScheme + .outline), + color: Theme.of(context) + .colorScheme + .primaryContainer, borderRadius: BorderRadius.circular(30), ), child: Column( @@ -754,8 +755,10 @@ class _ProfilePageState extends ConsumerState { UnderlineInputBorder( borderSide: BorderSide( - color: Color( - 0xFF454545), + color: Theme.of( + context) + .colorScheme + .outline, ), // Change to your desired color ), labelStyle: @@ -902,8 +905,10 @@ class _ProfilePageState extends ConsumerState { underline: Container( height: 1, - color: Color( - 0xFF454545), // Change to your desired color + color: Theme.of( + context) + .colorScheme + .outline, // Change to your desired color ), dropdownColor: Theme .of(context) @@ -957,8 +962,10 @@ class _ProfilePageState extends ConsumerState { underline: Container( height: 1, - color: Color( - 0xFF454545), // Change to your desired color + color: Theme.of( + context) + .colorScheme + .outline, // Change to your desired color ), dropdownColor: Theme .of(context) @@ -1047,51 +1054,59 @@ class _ProfilePageState extends ConsumerState { ), ), ), + SizedBox(height: 10), Row( - mainAxisAlignment: - MainAxisAlignment.center, children: [ - // Spacer(), - ElevatedButton( - onPressed: () { - if (_isEditMode) { - _saveChanges(ref); - } - }, - style: ElevatedButton.styleFrom( - padding: EdgeInsets.symmetric( - horizontal: 20, - vertical: 10), - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular( - 50.0), // Half of desired button height + Spacer(), + Expanded( + child: ElevatedButton( + onPressed: () { + if (_isEditMode) { + _saveChanges(ref); + } + }, + style: ElevatedButton.styleFrom( + padding: EdgeInsets.symmetric( + vertical: 15), + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular( + 50.0), // Half of desired button height + ), ), - ), - child: const Text( - "Save Changes", - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.w600, + child: Text( + "Save Changes", + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSecondaryContainer, + fontWeight: FontWeight.w600, + ), ), ), ), - - Spacer(), - IconButton( - onPressed: () { - setState(() { - // isExpanded = false; - // isBlurred = false; - _isEditMode = false; - }); - }, - icon: const Icon( - Icons.cancel_outlined, - color: Colors.white, - size: 30, - ), // Use Icon widget to specify the icon + Expanded( + child: Align( + alignment: + Alignment.centerRight, + child: IconButton( + onPressed: () { + setState(() { + // isExpanded = false; + // isBlurred = false; + _isEditMode = false; + }); + }, + icon: Icon( + Icons.cancel_outlined, + color: Theme.of(context) + .colorScheme + .onSecondaryContainer, + size: 30, + ), // Use Icon widget to specify the icon + ), + ), ), // SizedBox( // width: 10, @@ -1116,107 +1131,81 @@ class _ProfilePageState extends ConsumerState { ), ), ), - // !_isEditMode - // ? Container( - // margin: EdgeInsets.only(bottom: 15), - // child: ElevatedButton( - // onPressed: () { - // if (!_isEditMode) { - // // enableEditing(); - // setState(() { - // // isExpanded = true; - // // isBlurred = true; - // _isEditMode = true; - // }); - // Future.delayed(Duration(milliseconds: 1000), () { - // if (listScrollController.hasClients) { - // final position = - // listScrollController.position.viewportDimension; - // listScrollController.animateTo( - // position, - // duration: Duration(seconds: 1), - // curve: Curves.easeOut, - // ); - // } - // }); - // } - // }, - // style: ElevatedButton.styleFrom( - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular( - // 50.0), // Half of desired button height - // ), - // padding: - // EdgeInsets.symmetric(horizontal: 20, vertical: 10), - // ), - // child: //Text(_isEditMode ? 'Save Changes' : 'Edit'), - // const Text("EDIT"), - // ), - // ) - // : Container(), !_isEditMode ? (widget.justLoggedIn ? Container( padding: EdgeInsets.symmetric(vertical: 0, horizontal: 20), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only(bottom: 15), - child: ElevatedButton( - onPressed: () { - if (!_isEditMode) { - // enableEditing(); - setState(() { - // isExpanded = true; - // isBlurred = true; - _isEditMode = true; - }); - Future.delayed(Duration(milliseconds: 1000), - () { - if (listScrollController.hasClients) { - final position = listScrollController - .position.viewportDimension; - listScrollController.animateTo( - position, - duration: Duration(seconds: 1), - curve: Curves.easeOut, - ); - } - }); - } - }, - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 50.0), // Half of desired button height + Spacer(), + Expanded( + child: Container( + margin: EdgeInsets.only(bottom: 15), + child: ElevatedButton( + onPressed: () { + if (!_isEditMode) { + // enableEditing(); + setState(() { + // isExpanded = true; + // isBlurred = true; + _isEditMode = true; + }); + Future.delayed(Duration(milliseconds: 1000), + () { + if (listScrollController.hasClients) { + final position = listScrollController + .position.viewportDimension; + listScrollController.animateTo( + position, + duration: Duration(seconds: 1), + curve: Curves.easeOut, + ); + } + }); + } + }, + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 50.0), // Half of desired button height + ), + padding: EdgeInsets.symmetric( + horizontal: 20, vertical: 10), ), - padding: EdgeInsets.symmetric( - horizontal: 20, vertical: 10), + child: //Text(_isEditMode ? 'Save Changes' : 'Edit'), + const Text("EDIT"), ), - child: //Text(_isEditMode ? 'Save Changes' : 'Edit'), - const Text("EDIT"), ), ), - ElevatedButton( - onPressed: () async { - await _saveChanges(ref); - GoRouter.of(context).go('/main'); - }, - child: const Icon(Icons.arrow_forward), - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - Colors.transparent), - shape: MaterialStateProperty.all< - RoundedRectangleBorder>( - RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), + Expanded( + child: Align( + alignment: Alignment.centerRight, + child: SizedBox( + width: 60, + height: 50, + child: ElevatedButton( + onPressed: () async { + await _saveChanges(ref); + GoRouter.of(context).go('/main'); + }, + child: const Icon(Icons.arrow_forward), + style: ButtonStyle( + // backgroundColor: MaterialStateProperty.all( + // Colors.transparent), + shape: MaterialStateProperty.all< + RoundedRectangleBorder>( + RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(15.0), + ), + ), + padding: MaterialStateProperty.all( + EdgeInsets.zero), + ), ), ), - padding: - MaterialStateProperty.all(EdgeInsets.zero), ), ) ], diff --git a/lib/screens/profile_screen/widgets/customTextWithDivider.dart b/lib/screens/profile_screen/widgets/custom_text_with_divider.dart similarity index 96% rename from lib/screens/profile_screen/widgets/customTextWithDivider.dart rename to lib/screens/profile_screen/widgets/custom_text_with_divider.dart index 9f92cdff..1f864bf4 100644 --- a/lib/screens/profile_screen/widgets/customTextWithDivider.dart +++ b/lib/screens/profile_screen/widgets/custom_text_with_divider.dart @@ -40,7 +40,7 @@ class _CustomTextWithDividerState extends State { if (widget.showDivider) // Conditionally display the Divider Divider( thickness: 1, - color: Color(0xFF454545), + color: Theme.of(context).colorScheme.outline, ), // Divider( // thickness: 1, diff --git a/lib/screens/profile_screen/widgets/profile_text_field.dart b/lib/screens/profile_screen/widgets/profile_text_field.dart index 85ed14ec..9b9b6561 100644 --- a/lib/screens/profile_screen/widgets/profile_text_field.dart +++ b/lib/screens/profile_screen/widgets/profile_text_field.dart @@ -54,9 +54,12 @@ class _ProfileTextFieldState extends State { decoration: InputDecoration( enabledBorder: UnderlineInputBorder( borderSide: BorderSide( - color: Color(0xFF454545), + color: Theme.of(context).colorScheme.outline, ), // Change to your desired color ), + disabledBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context).colorScheme.inversePrimary)), labelStyle: const TextStyle( color: Colors.grey, ), diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index 022f9a31..79de07d7 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -21,7 +21,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:image_picker/image_picker.dart'; import 'package:tsec_app/models/student_model/student_model.dart'; import 'package:tsec_app/provider/auth_provider.dart'; -import 'package:tsec_app/screens/profile_screen/widgets/customTextWithDivider.dart'; +import 'package:tsec_app/screens/profile_screen/widgets/custom_text_with_divider.dart'; import 'package:tsec_app/screens/profile_screen/widgets/profile_screen_appbar.dart'; import 'package:tsec_app/screens/profile_screen/widgets/profile_text_field.dart'; import 'package:tsec_app/widgets/custom_scaffold.dart'; diff --git a/lib/services/timetable_service.dart b/lib/services/timetable_service.dart index 7828531a..f539a923 100644 --- a/lib/services/timetable_service.dart +++ b/lib/services/timetable_service.dart @@ -32,7 +32,7 @@ class TimeTableService { Stream?> getweekTimetable(String? data) { final d = data ?? NotificationType.yearBranchDivTopic; return _firestore - .collection('TimeTable') + .collection('TimeTable 2023') .doc(d) .snapshots() .map((doc) => doc.data()); diff --git a/lib/utils/themes.dart b/lib/utils/themes.dart index 49570fd5..f9eb6310 100644 --- a/lib/utils/themes.dart +++ b/lib/utils/themes.dart @@ -74,7 +74,15 @@ late final theme = ThemeData( displayColor: kBlack, ), fontFamily: "SF Pro Text", - colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.white), + colorScheme: ColorScheme.fromSwatch().copyWith( + secondary: Colors.white, + onPrimary: Color.fromARGB(255, 78, 73, 73), + inversePrimary: Color.fromARGB(255, 241, 241, 241), + primaryContainer: Colors.white, + secondaryContainer: Color(0xff00C62C), + onSecondaryContainer: Colors.black, + outline: Color(0xFFE0E0E0), + ), ); late final darkTheme = ThemeData( @@ -84,6 +92,7 @@ late final darkTheme = ThemeData( primaryColorDark: const Color(0xFF000000), shadowColor: const Color(0x00A9A9A9), cardColor: Colors.white70, + // textSecondaryColor: Color.fromARGB(255, 65, 60, 60), elevatedButtonTheme: _getElevatedButtonTheme( darkColor: kDarkModeDarkBlue, lightColor: kDarkModeLightBlue, @@ -97,7 +106,15 @@ late final darkTheme = ThemeData( displayColor: kWhite, ), fontFamily: "SF Pro Text", - colorScheme: ColorScheme.fromSwatch().copyWith(secondary: kLightBlack), + colorScheme: ColorScheme.fromSwatch().copyWith( + secondary: kLightBlack, + onPrimary: Color.fromARGB(255, 171, 171, 171), + primaryContainer: Color(0xFF323232), + secondaryContainer: Color(0xff00C62C), + onSecondaryContainer: Colors.white, + outline: Color(0xFF454545), + inversePrimary: Color.fromARGB(255, 63, 63, 63), + ), ); const _textTheme = TextTheme(