diff --git a/assets/brand/logo-black.png b/assets/brand/logo-black.png new file mode 100644 index 0000000..a2e5d3d Binary files /dev/null and b/assets/brand/logo-black.png differ diff --git a/assets/brand/logo-white.png b/assets/brand/logo-white.png new file mode 100644 index 0000000..620b787 Binary files /dev/null and b/assets/brand/logo-white.png differ diff --git a/assets/brand/symbol.png b/assets/brand/symbol.png new file mode 100644 index 0000000..01a2bbc Binary files /dev/null and b/assets/brand/symbol.png differ diff --git a/lib/components/Lists/class_list.dart b/lib/components/Lists/class_list.dart index 8176140..35f11d6 100644 --- a/lib/components/Lists/class_list.dart +++ b/lib/components/Lists/class_list.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/cards/class_card.dart'; -import 'package:neocloud_mobile/graphql/models/ClassModel.dart'; -import 'package:neocloud_mobile/graphql/services/class_service.dart'; +import 'package:neocloud_mobile/core/domain/entities/class_entity.dart'; import 'package:neocloud_mobile/components/widgets.dart'; -class ClassList extends StatefulWidget { +class ClassList extends StatelessWidget { const ClassList({ Key? key, this.classList, @@ -13,55 +12,38 @@ class ClassList extends StatefulWidget { this.spinnerScreeMaxHeight, }) : super(key: key); - final List? classList; + final List ? classList; final bool showClassAvatar; final double bodySeparationSize; final double? spinnerScreeMaxHeight; - @override - State createState() => _ClassListState(); -} - -class _ClassListState extends State { - var classService = ClassService(); - List? dataList; - - @override - void initState() { - super.initState(); - loadData(); - } - - void loadData() { - if (!mounted) return; - - if (widget.classList == null) { - classService.getClasses().then((classes) { - setState(() { - dataList = classes; - }); - }); - } else { - dataList = widget.classList; - } - } @override Widget build(BuildContext context) { - return dataList == null - ? spinnerScreen() - : dataList!.isEmpty - ? nothingWasFoundScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) - : Column( - children: List.generate( - dataList!.length, - (index) => ClassCard( - clas: dataList![index], - showClassAvatar: widget.showClassAvatar, - bodySeparationSize: widget.bodySeparationSize, - ), - ), - ); + return Builder( + builder: (context) { + if (classList == null){ + return spinnerScreen(context: context); + } + if (classList!.isEmpty) { + return nothingWasFoundScreen(context: context, screenMaxHeight: spinnerScreeMaxHeight); + } + + if (classList != null) { + return Column( + children: List.generate( + classList!.length, + (index) => ClassCard( + clas: classList![index], + showClassAvatar: showClassAvatar, + bodySeparationSize: bodySeparationSize, + ), + ), + ); + } + return Text('fix', style: Theme.of(context).textTheme.bodyMedium,); + }, + ); } diff --git a/lib/components/Lists/class_schedule_list.dart b/lib/components/Lists/class_schedule_list.dart index deab50c..ba5fe63 100644 --- a/lib/components/Lists/class_schedule_list.dart +++ b/lib/components/Lists/class_schedule_list.dart @@ -1,14 +1,14 @@ import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/cards/class_schedule_card.dart'; -import 'package:neocloud_mobile/graphql/models/ClassScheduleModel.dart'; -import 'package:neocloud_mobile/graphql/services/class_schedule_service.dart'; +import 'package:neocloud_mobile/core/data/data_sources/remote/class_schedule_service.dart'; +import 'package:neocloud_mobile/core/domain/entities/class_schedule_entity.dart'; import '../widgets.dart'; class ClassSchedulesList extends StatefulWidget { const ClassSchedulesList({super.key, this.classScheduleList, this.spinnerScreeMaxHeight}); - final List? classScheduleList; + final List? classScheduleList; final double? spinnerScreeMaxHeight; @override @@ -17,7 +17,7 @@ class ClassSchedulesList extends StatefulWidget { class _ClassSchedulesListState extends State { var classSchedule = ClassScheduleService(); - List? dataList; + List? dataList; @override void initState() { @@ -40,9 +40,9 @@ class _ClassSchedulesListState extends State { @override Widget build(BuildContext context) { return dataList == null - ? spinnerScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) + ? spinnerScreen(context: context, screenMaxHeight: widget.spinnerScreeMaxHeight) : dataList!.isEmpty - ? nothingWasFoundScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) + ? nothingWasFoundScreen(context: context, screenMaxHeight: widget.spinnerScreeMaxHeight) : Column( children: List.generate( dataList!.length, diff --git a/lib/components/Lists/class_works_list.dart b/lib/components/Lists/class_works_list.dart index 117e28f..0cf80ef 100644 --- a/lib/components/Lists/class_works_list.dart +++ b/lib/components/Lists/class_works_list.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/cards/class_works_card.dart'; -import 'package:neocloud_mobile/graphql/models/ClassworkModel.dart'; -import 'package:neocloud_mobile/graphql/services/classwork_service.dart'; +import 'package:neocloud_mobile/core/data/data_sources/remote/classwork_service.dart'; +import 'package:neocloud_mobile/core/domain/entities/classwork_entity.dart'; import '../widgets.dart'; @@ -13,7 +13,7 @@ class ClassworksList extends StatefulWidget { this.spinnerScreeMaxHeight }) : super(key: key); - final List? classworkList; + final List? classworkList; final bool showFeedback; final double? spinnerScreeMaxHeight; @@ -23,7 +23,7 @@ class ClassworksList extends StatefulWidget { class _ClassworksListState extends State { var classworkService = ClassworkService(); - List? dataList; + List? dataList; @override void initState() { @@ -48,9 +48,9 @@ class _ClassworksListState extends State { @override Widget build(BuildContext context) { return dataList == null - ? spinnerScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) + ? spinnerScreen(context: context, screenMaxHeight: widget.spinnerScreeMaxHeight) : dataList!.isEmpty - ? nothingWasFoundScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) + ? nothingWasFoundScreen(context: context, screenMaxHeight: widget.spinnerScreeMaxHeight) : Column( children: List.generate( dataList!.length, diff --git a/lib/components/Lists/faculty_list.dart b/lib/components/Lists/faculty_list.dart index a6ac022..8cd96be 100644 --- a/lib/components/Lists/faculty_list.dart +++ b/lib/components/Lists/faculty_list.dart @@ -1,8 +1,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/cards/faculty_card.dart'; -import 'package:neocloud_mobile/graphql/models/FacultyModel.dart'; -import 'package:neocloud_mobile/graphql/services/faculty_service.dart'; +import 'package:neocloud_mobile/core/data/data_sources/remote/faculty_service.dart'; +import 'package:neocloud_mobile/core/domain/entities/faculty_entity.dart'; import 'package:neocloud_mobile/models/Faculty.dart'; import '../widgets.dart'; @@ -10,7 +10,7 @@ import '../widgets.dart'; class FacultyList extends StatefulWidget { const FacultyList({Key? key, this.facultyList, this.spinnerScreeMaxHeight}) : super(key: key); - final List? facultyList; + final List? facultyList; final double? spinnerScreeMaxHeight; @override @@ -20,7 +20,7 @@ class FacultyList extends StatefulWidget { // (){} "" <> ? _ ! * class _FacultyListState extends State { var facultyService = FacultyService(); - List? dataList; + List? dataList; @override void initState() { @@ -49,9 +49,9 @@ class _FacultyListState extends State { // (index) => FacultyCard(faculty: facultiesList[index])), // ); return dataList == null - ? spinnerScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) + ? spinnerScreen(context: context, screenMaxHeight: widget.spinnerScreeMaxHeight) : dataList!.isEmpty - ? nothingWasFoundScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) + ? nothingWasFoundScreen(context: context, screenMaxHeight: widget.spinnerScreeMaxHeight) : Column( children: List.generate( facultiesList.length, diff --git a/lib/components/Lists/user_list.dart b/lib/components/Lists/user_list.dart index cc2dac9..10a63a9 100644 --- a/lib/components/Lists/user_list.dart +++ b/lib/components/Lists/user_list.dart @@ -1,66 +1,25 @@ import 'package:flutter/material.dart'; -import 'package:neocloud_mobile/components/tile/tiles.dart'; -import 'package:neocloud_mobile/graphql/models/UserModel.dart'; -import 'package:neocloud_mobile/graphql/services/user_service.dart'; -import 'package:neocloud_mobile/screens/Profile/profile_sceen.dart'; - +import 'package:neocloud_mobile/components/tile/user_tile.dart'; +import 'package:neocloud_mobile/core/domain/entities/user_entity.dart'; import '../widgets.dart'; -class UserList extends StatefulWidget { - const UserList({ - super.key, - this.usersList, - this.spinnerScreeMaxHeight - }); +class UserList extends StatelessWidget { + const UserList({super.key, this.users, this.spinnerScreeMaxHeight}); - final List? usersList; + final List? users; final double? spinnerScreeMaxHeight; - @override - State createState() => _UserListState(); -} - -class _UserListState extends State { - var userService = UserService(); - List? dataList; - - @override - void initState() { - super.initState(); - loadData(); - } - - void loadData() { - if (!mounted) return; - - if (widget.usersList == null) { - userService.getUsers().then((users) { - setState(() { dataList = users; }); - }); - } - } - @override Widget build(BuildContext context) { - if (widget.usersList != null) { dataList = widget.usersList; } - - return dataList == null - ? spinnerScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) - : dataList!.isEmpty - ? nothingWasFoundScreen(screenMaxHeight: widget.spinnerScreeMaxHeight) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: List.generate( - dataList!.length, - (index) => GestureDetector( - onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => ProfileScreen(user: dataList![index]),)), - child: UserTile( - user: dataList![index] - ), - ), - ), - ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: List.generate( + users!.length, + (index) => GestureDetector( + // onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => ProfileScreen(user: dataList![index]),)), + child: UserTile(user: users![index]), + ), + ), + ); } - - toList() {} } diff --git a/lib/components/appbar/actions.dart b/lib/components/appbar/actions.dart index fa29c8f..2a245f3 100644 --- a/lib/components/appbar/actions.dart +++ b/lib/components/appbar/actions.dart @@ -8,7 +8,6 @@ class actionUserButton extends StatelessWidget { super.key, this.icon, this.svg, - this.isDark = false, this.routeWidget, }); @@ -16,9 +15,6 @@ class actionUserButton extends StatelessWidget { // to be displayed final IconData? icon; final String? svg; - // action button is dark when this is true and white when - // is false - final bool isDark; // the route to be navigated to when this action button is clicked on final String routeName; // @@ -41,8 +37,8 @@ class actionUserButton extends StatelessWidget { color: Colors.transparent, padding: EdgeInsets.symmetric(horizontal: defaultSize * 2), child: svg != null - ? IconOrSvg(svg: svg!, color: isDark ? kBlack80 : kWhite, size: defaultSize * 2.5,) - : IconOrSvg(icon: icon!, color: isDark ? kBlack80 : kWhite, size: defaultSize * 2.5), + ? IconOrSvg(svg: svg!, size: defaultSize * 2.5,) + : IconOrSvg(icon: icon!, size: defaultSize * 2.5), ) ); } diff --git a/lib/components/appbar/appbar.dart b/lib/components/appbar/appbar.dart index c072e6d..4397779 100644 --- a/lib/components/appbar/appbar.dart +++ b/lib/components/appbar/appbar.dart @@ -3,13 +3,13 @@ import 'package:neocloud_mobile/components/appbar/actions.dart'; import 'package:neocloud_mobile/components/appbar/leading.dart'; import 'package:neocloud_mobile/components/texts.dart'; import 'package:neocloud_mobile/constraints.dart'; +import 'package:neocloud_mobile/core/utils/utils.dart'; class AppsAppBar extends StatelessWidget { AppsAppBar({ super.key, required this.title, - this.bgColor = Colors.white, - this.isDark = true, + this.bgColor, this.showLeading = true, this.elevation = 0, @@ -31,13 +31,7 @@ class AppsAppBar extends StatelessWidget { final String title; // the background color of the appbar - final Color bgColor; - - // this decides what the color of the title and the icons of the appbar - // are going to be. - // if isDark=true then the title, left icon and right icon are going to - // be {black}, else if isDark=false then they are all going to be {white} - final bool isDark; + final Color ? bgColor; // if this is true then the left icon is displayed, else it is not displayed final bool showLeading; @@ -55,14 +49,13 @@ class AppsAppBar extends StatelessWidget { // SvgPicture.asset() and // We expect either field above or the field to be // null, so that the other can render - final String? actionSvg1; - final String? actionSvg2; + String? actionSvg1; + String? actionSvg2; // Replacement // this is a callback function that is called when the action icon or svg // Function(BuildContext context)? pressAction; - // the elevation of the appBar final double elevation; @@ -72,37 +65,35 @@ class AppsAppBar extends StatelessWidget { final String routeName1; final String routeName2; - // routeWidget to be navigated to using push. Allows us to pass data to + // routeWidget to be navigated to using push. Allows us to pass data to // screens whose constructors requires passed in valued final Widget? routeWidget1; final Widget? routeWidget2; @override Widget build(BuildContext context) { + bgColor ?? getColorOpposite(Theme.of(context).canvasColor); + return AppBar( backgroundColor: bgColor, leadingWidth: defaultSize * 6, elevation: elevation, - leading: - showLeading ? LeadingBackButton(isDark: isDark) : const SizedBox(), - title: TextLarge( - title: title, - weight: FontWeight.w600, - color: isDark ? kBlack80 : Colors.white, + leading: showLeading ? const LeadingBackButton() : null, + title: Text( + title, + style: Theme.of(context).textTheme.titleMedium, ), actions: showAction1 ? [ actionUserButton( icon: actionIcon1, svg: actionSvg2, - isDark: isDark, routeName: routeName2, routeWidget: routeWidget2, ), actionUserButton( icon: actionIcon1, svg: actionSvg1, - isDark: isDark, routeName: routeName1, routeWidget: routeWidget1, ), @@ -115,15 +106,13 @@ class AppsAppBar extends StatelessWidget { class AppsSliverAppBar extends AppsAppBar { AppsSliverAppBar({ required super.title, - super.bgColor, - super.isDark, super.actionIcon1, super.actionIcon2 = Icons.search, super.actionSvg1, super.actionSvg2, super.showLeading, - super.showAction1, - super.showAction2, + super.showAction1 = false, + super.showAction2 = false, super.routeName1, super.routeName2, super.routeWidget1, @@ -133,38 +122,36 @@ class AppsSliverAppBar extends AppsAppBar { @override Widget build(BuildContext context) { + // if neither actionSvg or actionIcon was provided, then we want to + // set a default actionSvg value (to be displayed) + super.actionSvg1 = actionSvg1 == null && actionIcon1 == null + ? 'assets/icons/account.svg' + : null; return SliverAppBar( - backgroundColor: bgColor, leadingWidth: 60, elevation: elevation, floating: true, snap: true, - leading: - showLeading ? LeadingBackButton(isDark: isDark) : const SizedBox(), - title: TextLarge( - title: title, - weight: FontWeight.w600, - color: isDark ? kBlack80 : Colors.white, + leading: showLeading ? const LeadingBackButton() : const SizedBox(), + title: Text( + title, + style: Theme.of(context).textTheme.titleSmall, ), actions: [ - showAction2 - ? actionUserButton( + if (showAction2) + actionUserButton( icon: actionIcon2, svg: actionSvg2, - isDark: isDark, routeName: routeName2, routeWidget: routeWidget2, - ) - : SizedBox(), - showAction1 - ? actionUserButton( + ), + if (showAction1) + actionUserButton( icon: actionIcon1, svg: actionSvg1, - isDark: isDark, routeName: routeName1, routeWidget: routeWidget1, - ) - : SizedBox(), + ), ], ); } diff --git a/lib/components/appbar/leading.dart b/lib/components/appbar/leading.dart index d5bb25b..20fa875 100644 --- a/lib/components/appbar/leading.dart +++ b/lib/components/appbar/leading.dart @@ -1,15 +1,11 @@ import 'package:flutter/material.dart'; import 'package:neocloud_mobile/constraints.dart'; +import 'package:neocloud_mobile/core/utils/utils.dart'; // This is the back button for the AppBar of our position (<) class LeadingBackButton extends StatelessWidget { - // final Color backgroundColor; - final bool isDark; - const LeadingBackButton({ super.key, - this.isDark = false, - // this.backgroundColor = Colors.white, }); @override @@ -23,11 +19,10 @@ class LeadingBackButton extends StatelessWidget { Navigator.pop(context); }, child: Container( - color: kWhite, + color: getColorOpposite(Theme.of(context).canvasColor), padding: EdgeInsets.fromLTRB(defaultSize * 2, defaultSize * 2, defaultSize * 1.5, defaultSize * 2), child: Icon( Icons.arrow_back_ios, - color: isDark ? kBlack80 : kWhite, size: defaultSize * 2.5, ), ), diff --git a/lib/components/bottom_navbar/apps_bottom_navbar.dart b/lib/components/bottom_navbar/apps_bottom_navbar.dart deleted file mode 100644 index f3157a9..0000000 --- a/lib/components/bottom_navbar/apps_bottom_navbar.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:neocloud_mobile/constraints.dart'; -import 'package:neocloud_mobile/providers/NavItem.dart'; -import 'package:provider/provider.dart'; - -class AppsBottomNavBar extends StatelessWidget { - const AppsBottomNavBar({ - super.key, - }); - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (context, navItems, child) => Container( - decoration: BoxDecoration( - border: Border( - top: BorderSide(color: kBlack.withOpacity(.5), width: .2), - ), - ), - child: Row( - children: List.generate(navItems.items.length, (index) { - NavItem item = navItems.items[index]; - return Expanded( - child: InkWell( - onTap: () { - if (index != navItems.getSelectedIndex()) { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (_) => navItems.items[index].destination, - )); - navItems.changeNavIndex(index); - } - }, - highlightColor: kWhite, - splashColor: appsSplashColor, - radius: appsSplashRadius, - child: Container( - padding: EdgeInsets.only( - top: defaultSize, - bottom: defaultSize * 2.4, - ), - child: SvgPicture.asset( - navItems.getSelectedIndex() == index - ? item.svgActive - : item.svgInactive, - color: navItems.getSelectedIndex() == index - ? kBlue - : kBlack50, - ), - ), - ), - ); - }), - ), - ), - ); - } -} diff --git a/lib/components/buttons.dart b/lib/components/buttons.dart index f4f7487..c40f338 100644 --- a/lib/components/buttons.dart +++ b/lib/components/buttons.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/texts.dart'; import 'package:neocloud_mobile/constraints.dart'; +import 'package:neocloud_mobile/core/utils/utils.dart'; // Welcome Button class WelcomeButton extends StatelessWidget { @@ -21,35 +22,45 @@ class WelcomeButton extends StatelessWidget { Widget build(BuildContext context) { return TextButton( onPressed: press, - style: buildButtonStyle(), + style: buildButtonStyle(context), child: Container( // width: defaultSize * 22, - padding: EdgeInsets.symmetric(vertical: defaultSize * 1), + padding: const EdgeInsets.symmetric(vertical: 8), child: Stack( + alignment: Alignment.center, children: [ Center( - child: TextSmall( - title: title, color: Colors.white, weight: FontWeight.w500), + child: Text( + title, + style: TextStyle( + color: getColorOpposite(Theme.of(context).canvasColor), + fontWeight: FontWeight.w500, + ), + ), ), // Arrow iconIsLeading - ? Positioned( - left: defaultSize * 1.2, - top: defaultSize * .2, - child: Icon( - Icons.arrow_back_ios, - color: Colors.white, - size: defaultSize * 1.6, + ? Align( + alignment: Alignment.centerRight, + child: Container( + padding: const EdgeInsets.only(left: 10), + child: Icon( + Icons.arrow_back_ios, + color: getColorOpposite(Theme.of(context).canvasColor), + size: defaultSize * 1.6, + ), ), ) - : Positioned( - right: defaultSize * 1.2, - top: defaultSize * .2, - child: Icon( - Icons.arrow_forward_ios, - color: Colors.white, - size: defaultSize * 1.6, + : Align( + alignment: Alignment.centerRight, + child: Container( + padding: const EdgeInsets.only(right: 10), + child: Icon( + Icons.arrow_forward_ios, + color: getColorOpposite(Theme.of(context).canvasColor), + size: defaultSize * 1.6, + ), ), ), ], @@ -58,9 +69,10 @@ class WelcomeButton extends StatelessWidget { ); } - ButtonStyle buildButtonStyle() { + ButtonStyle buildButtonStyle(BuildContext context) { return ButtonStyle( - backgroundColor: MaterialStatePropertyAll(kBlueLight), + backgroundColor: + MaterialStatePropertyAll(Theme.of(context).primaryColor), shape: const MaterialStatePropertyAll( RoundedRectangleBorder( borderRadius: BorderRadius.all( @@ -74,67 +86,94 @@ class WelcomeButton extends StatelessWidget { // Apps Main Button class AppsButton extends StatelessWidget { - const AppsButton({ + AppsButton({ super.key, required this.title, required this.press, this.icon, - this.color = Colors.white, - this.iconColor = Colors.white, + this.color, + this.iconColor, this.bgColor = Colors.blueAccent, this.bgColorLoading = Colors.blue, this.border = 0, this.borderRadius = 10, + this.fontSize = 16, this.textIconSeperationSize = 5, this.padTopBottom = 6, - this.padLeftRight = 6, + this.padLeftRight = 6, this.weight = FontWeight.w400, this.isLoading = false, + this.minButtonHeight = 40, + this.maxButtonHeight = 60, }); final String title; - final Color color; + late Color? color; final Color bgColor; final Color bgColorLoading; - final Color iconColor; + late Color? iconColor; final IconData? icon; final double border; final double borderRadius; + final double fontSize; final double textIconSeperationSize; final Function(BuildContext context) press; final double padTopBottom; final double padLeftRight; final FontWeight weight; final bool isLoading; + final double minButtonHeight; + final double maxButtonHeight; @override Widget build(BuildContext context) { + color ??= Colors.white; + iconColor ??= getColorOpposite(Theme.of(context).canvasColor); + return TextButton( onPressed: !isLoading ? () => press(context) : null, - style: buildButtonStyle(), + style: buildButtonStyle(context), child: Container( - constraints: BoxConstraints(minHeight: defaultSize * 4, maxHeight: defaultSize * 4), + constraints: BoxConstraints( + minHeight: minButtonHeight, maxHeight: maxButtonHeight), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ icon != null ? Icon(icon, color: iconColor) : const SizedBox(), - icon != null ? SizedBox(width: textIconSeperationSize) : const SizedBox(), + icon != null + ? SizedBox(width: textIconSeperationSize) + : const SizedBox(), isLoading - ? SizedBox(height: 20, width: 20, child: CircularProgressIndicator(color: kWhite, strokeWidth: 3)) - : TextMedium(title: title, color: color, weight: weight), + ? const SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 3, + ), + ) + : Text(title, + style: TextStyle( + fontFamily: 'Poppins', + color: color, + fontWeight: weight, + fontSize: fontSize)), ], ), ), ); } - ButtonStyle buildButtonStyle() { + ButtonStyle buildButtonStyle(BuildContext context) { return ButtonStyle( - backgroundColor: MaterialStatePropertyAll(!isLoading ? bgColor : bgColorLoading), + backgroundColor: MaterialStatePropertyAll( + !isLoading ? bgColor : bgColorLoading), shape: MaterialStatePropertyAll( RoundedRectangleBorder( side: border > 0 - ? BorderSide(width: border, color: kBlack50) + ? BorderSide( + width: border, + color: Theme.of(context).canvasColor.withOpacity(.5)) : const BorderSide(color: Colors.transparent), borderRadius: BorderRadius.all( Radius.circular(borderRadius), @@ -150,7 +189,7 @@ class AppsIconButton extends AppsButton { super.title = "", required super.press, super.icon, - super.iconColor = Colors.black87, + super.iconColor, super.bgColor, super.borderRadius, super.padTopBottom = 18, @@ -159,6 +198,8 @@ class AppsIconButton extends AppsButton { @override Widget build(BuildContext context) { + iconColor ??= Theme.of(context).canvasColor.withOpacity(.8); + return InkWell( onTap: () => press(context), borderRadius: BorderRadius.circular(borderRadius), @@ -171,41 +212,16 @@ class AppsIconButton extends AppsButton { borderRadius: BorderRadius.circular(borderRadius), color: bgColor, ), - child: Center(child: Icon(icon, color: iconColor,)), + child: Center( + child: Icon( + icon, + color: iconColor, + )), ), ); } } - -// Option Button -class OptionButton extends StatelessWidget { - const OptionButton({ - Key? key, - required this.title, - required this.press, - this.bgColor = Colors.transparent, - }) : super(key: key); - - final String title; - final Color bgColor; - final Function() press; - - @override - Widget build(BuildContext context) { - return AppsButton( - title: title, - borderRadius: buttonBorderRadius, - bgColor: bgColor, - color: bgColor == kBlueLight? kWhite : kBlack70, - press: (context) => press(), - padTopBottom: .5, - weight: bgColor == kBlueLight? FontWeight.w600 : FontWeight.w400, - ); - } -} - - // Dropdown Button class AppsDropdownButton extends StatefulWidget { const AppsDropdownButton({ @@ -247,8 +263,12 @@ class _AppsDropdownButtonState extends State { underline: Container(height: 0), items: widget.list.map((String month) { return DropdownMenuItem( - child: - TextSmall(title: month, color: kBlack50, weight: FontWeight.w500), + child: Text( + month, + style: TextStyle( + color: Theme.of(context).canvasColor.withOpacity(.5), + fontWeight: FontWeight.w500), + ), value: month, ); }).toList(), @@ -256,59 +276,65 @@ class _AppsDropdownButtonState extends State { } } - // Icon Text Button class IconTextButton extends StatelessWidget { - const IconTextButton(this.text, { + IconTextButton( + this.text, { super.key, this.icon = Icons.add, - this.iconColor = Colors.black54, - this.textColor = Colors.black38, + this.iconColor, + this.textColor, this.backgroundColor = Colors.blue, this.borderWidth = 1.5, - this.borderColor = Colors.black, + this.borderColor, this.fullWidth = false, required this.press, }); - + final String text; final IconData? icon; - final Color iconColor; - final Color textColor; + late Color? iconColor; + late Color? textColor; final Color backgroundColor; final double borderWidth; - final Color borderColor; + late Color? borderColor; final bool fullWidth; final Function() press; @override Widget build(BuildContext context) { + borderColor ??= Theme.of(context).canvasColor; + iconColor ??= Theme.of(context).canvasColor.withOpacity(.5); + textColor ??= Theme.of(context).canvasColor.withOpacity(.4); return Container( height: defaultSize * 4.5, decoration: BoxDecoration( - color: backgroundColor, - border: Border.all(width: borderWidth, color: borderColor), - borderRadius: BorderRadius.circular(defaultSize) - ), + color: backgroundColor, + border: Border.all(width: borderWidth, color: borderColor!), + borderRadius: BorderRadius.circular(defaultSize)), child: TextButton( onPressed: press, style: ButtonStyle( - padding: MaterialStatePropertyAll( - EdgeInsets.symmetric(horizontal: defaultSize * .7, vertical: 0) - ) - - ), + padding: MaterialStatePropertyAll(EdgeInsets.symmetric( + horizontal: defaultSize * .7, vertical: 0))), child: Row( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: fullWidth ? MainAxisSize.max : MainAxisSize.min, children: [ - Icon(icon, color: Colors.black38, size: 30), - const SizedBox(width: 5), - TextLarge(title: text, weight: FontWeight.w500, color: textColor), + Icon(icon, + color: Theme.of(context).canvasColor.withOpacity(.4), size: 30), const SizedBox(width: 5), + Text( + text, + style: TextStyle( + color: textColor, + fontWeight: FontWeight.w500, + ), + ), + // const SizedBox(width: 5), ], ), - ), - ); + ), + ); } -} \ No newline at end of file +} diff --git a/lib/components/calendar_widget.dart b/lib/components/calendar_widget.dart index 2a1a33f..e22029c 100644 --- a/lib/components/calendar_widget.dart +++ b/lib/components/calendar_widget.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:neocloud_mobile/components/texts.dart'; import 'package:neocloud_mobile/components/widgets.dart'; import 'package:neocloud_mobile/constraints.dart'; -import 'package:neocloud_mobile/graphql/models/ClassScheduleModel.dart'; -import 'package:neocloud_mobile/utils/calendar.dart'; -import 'package:neocloud_mobile/utils/locator.dart'; - +import 'package:neocloud_mobile/core/utils/calendar.dart'; +import 'package:neocloud_mobile/core/utils/date_selection.dart'; +import 'package:neocloud_mobile/core/utils/utils.dart'; +import 'package:neocloud_mobile/injection_container.dart'; class CalendarWidget extends StatefulWidget { const CalendarWidget({ @@ -22,7 +21,7 @@ class CalendarWidget extends StatefulWidget { } class _CalendarWidgetState extends State { - Calendar calendar = getIt(); + Calendar calendar = sl(); late List calendarYears; // This is used to know the exact location of the month section that should be scrolled automatically to when this widget mounts late ScrollController _scrollController; @@ -33,11 +32,14 @@ class _CalendarWidgetState extends State { super.initState(); final now = DateTime.now(); // Scroll to current month section - calendarYears = calendar.getMultipleCalendarYearData(now.year-1, now.year+1); - int yearHeight = 3900; // calendar year height + calendarYears = + calendar.getMultipleCalendarYearData(now.year - 1, now.year + 1); + int yearHeight = 3900; // calendar year height int skipYear = yearHeight * 1; double monthHeightPercentage = .083; - _scrollController = ScrollController(initialScrollOffset: skipYear + yearHeight * (monthHeightPercentage * ((now.month - 1)))); + _scrollController = ScrollController( + initialScrollOffset: skipYear + + yearHeight * (monthHeightPercentage * ((now.month - 1)))); _dateSelected = widget.defaultDateSelection; } @@ -46,89 +48,118 @@ class _CalendarWidgetState extends State { return SingleChildScrollView( controller: _scrollController, child: Container( - color: kBlue.withOpacity(.05), + color: Theme.of(context).primaryColor.withOpacity(.05), padding: screenPadding, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: List.generate( - calendarYears.length, - (yearIndex) { - CalendarYear calendarYear = calendarYears[yearIndex]; - List calendarMonths = calendarYear.months; - - // return SizedBox(); - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: List.generate( - calendarMonths.length, + children: List.generate(calendarYears.length, (yearIndex) { + CalendarYear calendarYear = calendarYears[yearIndex]; + List calendarMonths = calendarYear.months; + + // return SizedBox(); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: List.generate( + calendarMonths.length, (monthIndex) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 20), - - // Title - Month and Year - TextMedium(title: '${calendarMonths[monthIndex].month} ${calendarYear.year}', color: Colors.grey[700], weight: FontWeight.w500), - - // Days - const SizedBox(height: 10), - GridView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 7, mainAxisSpacing: 5, crossAxisSpacing: 5), - itemCount: calendarMonths[monthIndex].daysInMonth + calendarMonths[monthIndex].startDay, - itemBuilder: (context, index) { + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 20), + + // Title - Month and Year + // TextMedium(title: '${calendarMonths[monthIndex].month} ${calendarYear.year}', color: Colors.grey[700], weight: FontWeight.w500), + Text( + '${calendarMonths[monthIndex].month} ${calendarYear.year}', + style: TextStyle( + fontSize: 16, + color: Theme.of(context) + .canvasColor + .withOpacity(.7), + fontWeight: FontWeight.w500), + ), + + // Days + const SizedBox(height: 10), + GridView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 7, + mainAxisSpacing: 5, + crossAxisSpacing: 5), + itemCount: calendarMonths[monthIndex].daysInMonth + + calendarMonths[monthIndex].startDay, + itemBuilder: (context, index) { + var now = DateTime.now(); + bool isCurrentMonth = + calendarYear.year == now.year && + calendarMonths[monthIndex].monthNumber == + now.month; + int day = (index + 1) - + calendarMonths[monthIndex].startDay; + DateSelection dateSelection = DateSelection( + year: calendarYear.year, + month: monthIndex + 1, + day: day); + bool dateIsSelected = _dateSelected != null && + DateSelection.compareDateSelection( + _dateSelected!, dateSelection); - var now = DateTime.now(); - bool isCurrentMonth = calendarYear.year == now.year && calendarMonths[monthIndex].monthNumber == now.month; - int day = (index + 1) - calendarMonths[monthIndex].startDay; - DateSelection dateSelection = DateSelection(year: calendarYear.year, month: monthIndex + 1, day: day); - bool dateIsSelected = _dateSelected != null && DateSelection.compareDateSelection(_dateSelected!, dateSelection); - - if (index < calendarMonths[monthIndex].startDay) { - return const SizedBox(); - } else { - return GestureDetector( - onTap: () { - setState(() { - _dateSelected = dateSelection; - }); - // press - widget.updateDateSelection(dateSelection); - }, - child: AnimatedContainer( - duration: const Duration(milliseconds: 300), - curve: Curves.easeInOut, - height: 10, - width: 10, - decoration: BoxDecoration( - color: dateIsSelected - ? kBlueLight - : isCurrentMonth && day == now.day - ? kBlueLight.withOpacity(.3) - : null, - borderRadius: const BorderRadius.all(Radius.circular(10)) - ), - child: Center( - child: TextMedium( - title: '$day', - color: dateIsSelected - ? Colors.white - : Colors.grey[900], + if (index < calendarMonths[monthIndex].startDay) { + return const SizedBox(); + } else { + return GestureDetector( + onTap: () { + setState(() { + _dateSelected = dateSelection; + }); + // press + widget.updateDateSelection(dateSelection); + }, + child: AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + height: 10, + width: 10, + decoration: BoxDecoration( + color: dateIsSelected + ? Theme.of(context).primaryColor + : isCurrentMonth && day == now.day + ? Theme.of(context).primaryColor.withOpacity(.3) + : null, + borderRadius: const BorderRadius.all( + Radius.circular(10))), + child: Center( + // child: TextMedium( + // title: '$day', + // color: dateIsSelected + // ? Colors.white + // : Colors.grey[900], + // ), + child: Text( + '$day', + style: TextStyle( + fontSize: 16, + color: dateIsSelected + ? getColorOpposite( + Theme.of(context).canvasColor) + : Theme.of(context) + .canvasColor + .withOpacity(.9), + ), + )), ), - ), - ), - ); - } - }, - ), - const SizedBox(height: 20), - const HorizontalRule(), - ], - ) - ), - ); - } - ).toList(), + ); + } + }, + ), + const SizedBox(height: 20), + const HorizontalRule(), + ], + )), + ); + }).toList(), ), ), ); diff --git a/lib/components/cards/cart_card.dart b/lib/components/cards/cart_card.dart index a65d1b0..ef8972b 100644 --- a/lib/components/cards/cart_card.dart +++ b/lib/components/cards/cart_card.dart @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/buttons.dart'; import 'package:neocloud_mobile/components/texts.dart'; import 'package:neocloud_mobile/constraints.dart'; +import 'package:neocloud_mobile/core/utils/utils.dart'; import 'package:neocloud_mobile/models/Courses.dart'; import 'package:neocloud_mobile/screens/course/course_screen.dart'; -import 'package:neocloud_mobile/utils/utils.dart'; class CartCard extends StatelessWidget { const CartCard({ @@ -32,36 +32,28 @@ class CartCard extends StatelessWidget { // Item Details SizedBox(width: defaultSize * 2), - buildCartInfo(), + buildCartInfo(context), ], ), ), ); } - Widget buildCartInfo() { + Widget buildCartInfo(BuildContext context) { return Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Title - TextExtraLarge( - title: course.title, weight: FontWeight.w600, color: kBlack80), + Text(course.title, style: Theme.of(context).textTheme.titleMedium), // Educator - SizedBox(height: defaultSize * .5), - TextSmall( - title: course.user.fullName, - color: kBlack50, - ), + // SizedBox(height: defaultSize * .5), + Text(course.user.fullName, style: Theme.of(context).textTheme.bodySmall,), // {percentage} discount SizedBox(height: defaultSize * .5), - TextSmall( - title: "${course.discount}% discount", - color: kBlack70, - weight: FontWeight.w500, - ), + Text("${course.discount}% discount", style: TextStyle(color: Theme.of(context).canvasColor.withOpacity(.7), fontWeight: FontWeight.w500)), // Price SizedBox(height: defaultSize * .5), @@ -72,7 +64,7 @@ class CartCard extends StatelessWidget { text1FontSize: defaultSize * 1.4, text1Decoration: TextDecoration.lineThrough, text2FontWeight: FontWeight.w600, - text2Color: kBlack80, + text2Color: Theme.of(context).canvasColor.withOpacity(.8), ), // Move to / Remove @@ -84,7 +76,7 @@ class CartCard extends StatelessWidget { TextLink( title: "Move to wishlist", press: (context) => print("Move to wishlist clicked ..."), - color: kBlue, + color: Theme.of(context).primaryColor, weight: FontWeight.w500, ), @@ -93,7 +85,7 @@ class CartCard extends StatelessWidget { TextLink( title: "Remove", press: (context) => print("Remove clicked ..."), - color: kBlue, + color: Theme.of(context).primaryColor, weight: FontWeight.w500, ), ], @@ -105,7 +97,7 @@ class CartCard extends StatelessWidget { title: "Purchase", press: (_) => print("Purchase Button clicked ..."), padTopBottom: defaultSize * .3, - bgColor: kBlack80, + bgColor: Theme.of(context).canvasColor.withOpacity(.8), borderRadius: defaultSize * .5, ) ], diff --git a/lib/components/cards/class_card.dart b/lib/components/cards/class_card.dart index 15a8255..4d373c0 100644 --- a/lib/components/cards/class_card.dart +++ b/lib/components/cards/class_card.dart @@ -3,10 +3,10 @@ import 'package:neocloud_mobile/components/images.dart'; import 'package:neocloud_mobile/components/cards/components/tablets.dart'; import 'package:neocloud_mobile/components/texts.dart'; import 'package:neocloud_mobile/constraints.dart'; -import 'package:neocloud_mobile/graphql/models/ClassModel.dart'; -import 'package:neocloud_mobile/models/Class.dart'; +import 'package:neocloud_mobile/core/domain/entities/class_entity.dart'; +import 'package:neocloud_mobile/core/utils/utils.dart'; import 'package:neocloud_mobile/screens/class/class_screen.dart'; -import 'package:neocloud_mobile/utils/utils.dart'; +import 'package:skeletons/skeletons.dart'; class ClassCard extends StatelessWidget { const ClassCard({ @@ -19,7 +19,7 @@ class ClassCard extends StatelessWidget { this.showBottomBorder = true, }); - final ClassModel clas; + final ClassEntity clas; final bool allowSeeMore; final double bodySeparationSize; // we use this because we use this card in the class screen and @@ -48,7 +48,7 @@ class ClassCard extends StatelessWidget { decoration: showBottomBorder ? BoxDecoration( border: Border( - bottom: appsBorder, + bottom: appsBorder(context), ), ) : const BoxDecoration(), @@ -72,7 +72,7 @@ class ClassCard extends StatelessWidget { TextCustom( title: clas.name!, fontSize: defaultSize * 2.2, - color: kBlack80, + color: Theme.of(context).canvasColor.withOpacity(.8), weight: FontWeight.w700, ), @@ -84,20 +84,17 @@ class ClassCard extends StatelessWidget { // Name SizedBox(height: defaultSize), Expanded( - child: buildAvatarAndName( - avatar: clas.educators != null && clas.educators!.length > 0 - ? clas.educators![0].avatar ?? '' : '', - name: clas.educators != null && clas.educators!.length > 0 - ? clas.educators![0].name : 'daniel', + child: CircularAvatarAndName( + avatar: clas.educators != null && clas.educators!.isNotEmpty && clas.educators![0].avatar != null + ? clas.educators![0].avatar! : '', + name: clas.educators != null && clas.educators!.isNotEmpty && clas.educators![0].name != null + ? clas.educators![0].name! : 'john doe', fontSize: defaultSize * 1.6, weight: FontWeight.w600), ), // Ratings - TextMedium( - title: getRatingFormat(50), - weight: FontWeight.w600, - ), + Text(getRatingFormat(50), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Theme.of(context).canvasColor.withOpacity(.8))), SizedBox(width: defaultSize * .5), Icon( Icons.star_rounded, @@ -112,13 +109,13 @@ class ClassCard extends StatelessWidget { allowSeeMore ? TextSeeMore( text: clas.about ?? '', - color: kBlack70, + color: Theme.of(context).canvasColor.withOpacity(.7), fontSize: defaultSize * 1.6, maxLines: 2, ) : TextCustomMaxLine( title: clas.about ?? '', - color: kBlack70, + color: Theme.of(context).canvasColor.withOpacity(.7), fontSize: defaultSize * 1.6, maxLines: 3, ), @@ -147,3 +144,114 @@ class ClassCard extends StatelessWidget { ); } } + + +class ClassCardSkeleton extends StatelessWidget { + const ClassCardSkeleton({ + super.key, + }); + + @override + Widget build(BuildContext context) { + return SkeletonItem( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Cover + const SkeletonLine( + style: SkeletonLineStyle(height: 220), + ), + + const SizedBox(height: 20), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + const SkeletonLine( + style: SkeletonLineStyle( + height: 18, + width: 200, + borderRadius: BorderRadius.all(Radius.circular(20))), + ), + + // Row (Avatar, Name) + const SizedBox(height: 17), + Row( + children: const [ + // avatar + SkeletonAvatar( + style: SkeletonAvatarStyle( + width: 30, + height: 30, + borderRadius: BorderRadius.all(Radius.circular(30)), + ), + ), + + // name + SizedBox(width: 18), + SkeletonLine( + style: SkeletonLineStyle( + height: 14, + width: 120, + borderRadius: BorderRadius.all(Radius.circular(20))), + ), + ], + ), + + // Description + const SizedBox(height: 17), + const SkeletonLine( + style: SkeletonLineStyle( + height: 12, + borderRadius: BorderRadius.all(Radius.circular(20))), + ), + const SizedBox(height: 10), + const SkeletonLine( + style: SkeletonLineStyle( + height: 12, + borderRadius: BorderRadius.all(Radius.circular(20))), + ), + const SizedBox(height: 10), + + const SkeletonLine( + style: SkeletonLineStyle( + height: 12, + width: 140, + borderRadius: BorderRadius.all(Radius.circular(20))), + ), + + // Tablets (Faculty, Hod) + const SizedBox(height: 20), + Row( + children: const [ + // Faculty + SkeletonLine( + style: SkeletonLineStyle( + height: 30, + width: 100, + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + + // Hod + SizedBox(width: 10), + SkeletonLine( + style: SkeletonLineStyle( + height: 30, + width: 120, + borderRadius: BorderRadius.all(Radius.circular(5))), + ), + ], + ) + ], + ), + ), + + const SizedBox(height: 20), + ], + ), + ); + } +} + diff --git a/lib/components/cards/class_schedule_card.dart b/lib/components/cards/class_schedule_card.dart index 504fb67..82d5467 100644 --- a/lib/components/cards/class_schedule_card.dart +++ b/lib/components/cards/class_schedule_card.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/cards/components/tablets.dart'; +import 'package:neocloud_mobile/components/images.dart'; import 'package:neocloud_mobile/components/texts.dart'; import 'package:neocloud_mobile/constraints.dart'; -import 'package:neocloud_mobile/graphql/models/ClassScheduleModel.dart'; +import 'package:neocloud_mobile/core/constants/constants.dart'; +import 'package:neocloud_mobile/core/domain/entities/class_schedule_entity.dart'; class ClassScheduleCard extends StatelessWidget { const ClassScheduleCard({ @@ -10,7 +12,7 @@ class ClassScheduleCard extends StatelessWidget { required this.classSchedule, }); - final ClassScheduleModel classSchedule; + final ClassScheduleEntity classSchedule; @override Widget build(BuildContext context) { @@ -18,14 +20,14 @@ class ClassScheduleCard extends StatelessWidget { return Container( padding: screenPadding, decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: kBlack50, width: .2))), + border: Border(bottom: BorderSide(color: Theme.of(context).canvasColor.withOpacity(.5), width: .2))), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ // Educator {Avatar - Name} SizedBox(height: defaultSize * 2), // TODO: use actual educators when a form that connects everything has been used to connect things up - buildAvatarAndName( + CircularAvatarAndName( // avatar: classwork.clas!.educators![0].avatar, // name: classwork.clas!.educators![0].name, avatar: defaultProfileAvatar, @@ -36,15 +38,16 @@ class ClassScheduleCard extends StatelessWidget { // Class Title SizedBox(height: defaultSize), - buildCardHeader(title: classSchedule.title), + buildCardHeader(context: context, title: classSchedule.title ?? 'null title'), // About SizedBox(height: defaultSize * 1.5), - TextSmall( - title: classSchedule.description ?? '', - color: kBlack70, - // weight: FontWeight.w400, - ), + // TextSmall( + // title: , + // color: Theme.of(context).canvasColor.withOpacity(.7), + // // weight: FontWeight.w400, + // ), + Text(classSchedule.description ?? '', style: Theme.of(context).textTheme.bodySmall), // Bottom Tablets SizedBox(height: defaultSize * 2), @@ -53,13 +56,13 @@ class ClassScheduleCard extends StatelessWidget { IconText( title: 'August 12', icon: Icons.calendar_month, - iconColor: kBlack70, + iconColor: Theme.of(context).canvasColor.withOpacity(.7), fontSize: defaultSize * 1.4), SizedBox(width: defaultSize * 2,), IconText( title: '9:30 am - 12:30pm', icon: Icons.timer, - iconColor: kBlack70, + iconColor: Theme.of(context).canvasColor.withOpacity(.7), fontSize: defaultSize * 1.4), ], ), diff --git a/lib/components/cards/class_works_card.dart b/lib/components/cards/class_works_card.dart index e0464f3..c3a7988 100644 --- a/lib/components/cards/class_works_card.dart +++ b/lib/components/cards/class_works_card.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; import 'package:neocloud_mobile/components/cards/components/text_big_small.dart'; import 'package:neocloud_mobile/components/images.dart'; -import 'package:neocloud_mobile/components/cards/components/tablets.dart'; import 'package:neocloud_mobile/components/texts.dart'; import 'package:neocloud_mobile/constraints.dart'; -import 'package:neocloud_mobile/graphql/models/ClassworkModel.dart'; +import 'package:neocloud_mobile/core/constants/constants.dart'; +import 'package:neocloud_mobile/core/domain/entities/classwork_entity.dart'; import 'package:neocloud_mobile/screens/classwork/classwork_screen.dart'; class ClassWorkCard extends StatelessWidget { @@ -15,7 +15,7 @@ class ClassWorkCard extends StatelessWidget { this.showFeedback = true, }); - final ClassworkModel classwork; + final ClassworkEntity classwork; final bool showFeedback; final bool enableGestureDecorator; @@ -33,7 +33,7 @@ class ClassWorkCard extends StatelessWidget { child: Container( // padding: screenPadding, decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: kBlack50, width: .2))), + border: Border(bottom: BorderSide(color: Theme.of(context).canvasColor.withOpacity(.5), width: .2))), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ @@ -43,14 +43,14 @@ class ClassWorkCard extends StatelessWidget { // Feedback SizedBox(height: defaultSize * 2), - showFeedback ? buildClassworkFeedbacks() : SizedBox(), + showFeedback ? buildClassworkFeedbacks(context) : SizedBox(), ], ), ), ); } - Column buildClassworkFeedbacks() { + Column buildClassworkFeedbacks(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -62,16 +62,16 @@ class ClassWorkCard extends StatelessWidget { ), decoration: BoxDecoration( border: Border( - top: BorderSide(color: kBlack.withOpacity(.2), width: 1), - bottom: BorderSide(color: kBlack.withOpacity(.2), width: 1), + top: BorderSide(color: Theme.of(context).canvasColor.withOpacity(.2), width: 1), + bottom: BorderSide(color: Theme.of(context).canvasColor.withOpacity(.2), width: 1), )), child: Row( children: [ TextBigSmall( bigText: '3', smallText: 'Submission', - bigTextColor: kBlack80, - smallTextColor: kBlack60, + bigTextColor: Theme.of(context).canvasColor.withOpacity(.8), + smallTextColor: Theme.of(context).canvasColor.withOpacity(.6), smallTextSize: defaultSize * 1.6, ), SizedBox( @@ -80,8 +80,8 @@ class ClassWorkCard extends StatelessWidget { TextBigSmall( bigText: '3', smallText: 'Feedbacks', - bigTextColor: kBlack80, - smallTextColor: kBlack60, + bigTextColor: Theme.of(context).canvasColor.withOpacity(.8), + smallTextColor: Theme.of(context).canvasColor.withOpacity(.6), smallTextSize: defaultSize * 1.6, ), SizedBox( @@ -90,8 +90,8 @@ class ClassWorkCard extends StatelessWidget { TextBigSmall( bigText: '1', smallText: 'Student Left', - bigTextColor: kBlack80, - smallTextColor: kBlack60, + bigTextColor: Theme.of(context).canvasColor.withOpacity(.8), + smallTextColor: Theme.of(context).canvasColor.withOpacity(.6), smallTextSize: defaultSize * 1.6, ) ], @@ -103,7 +103,7 @@ class ClassWorkCard extends StatelessWidget { padding: EdgeInsets.symmetric( vertical: defaultSize * 2, horizontal: defaultSize * 1.5), decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: kBlack50, width: .2))), + border: Border(bottom: BorderSide(color: Theme.of(context).canvasColor.withOpacity(.5), width: .2))), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -112,7 +112,7 @@ class ClassWorkCard extends StatelessWidget { padding: const EdgeInsets.only(top: 0), child: RoundBoxAvatar( size: defaultSize * 5, - image: classwork.clas!.educators![0].avatar ?? ''), + image: classwork.clas!.educators![0].avatar ?? defaultSlugAvatar), ), // Notifications Info @@ -124,15 +124,11 @@ class ClassWorkCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ // Users Full Name - TextLarge( - title: classwork.clas!.educators![0].name ?? '', - weight: FontWeight.w600, - color: kBlack90, - ), + Text(classwork.clas!.educators![0].name ?? 'john doe', style: Theme.of(context).textTheme.titleMedium,), // Notification Body SizedBox(height: defaultSize), - TextMedium(title: classwork.body, color: kBlack70), + Text(classwork.body ?? 'null classwork body', style: Theme.of(context).textTheme.bodyMedium), ], ), ) @@ -150,24 +146,10 @@ class TheClassworkCard extends StatelessWidget { required this.classwork, }); - final ClassworkModel classwork; + final ClassworkEntity classwork; @override Widget build(BuildContext context) { - var faculty = classwork.faculty!; - var classSchedule = classwork.classSchedule!; - var module = classwork.classSchedule!.classModule!; - - print(faculty); - print(classSchedule); - print(module); - - // List tabletData = [ - // {'value': faculty.name, 'color': kOrange}, - // {'value': 'Module ${module.order} - C${classSchedule.order}' , 'color': kRed}, - // {'value': 'Due ${classwork.deadline}' , 'color': kBlue}, - // ]; - return Padding( padding: screenPadding, child: Column( @@ -175,7 +157,7 @@ class TheClassworkCard extends StatelessWidget { children: [ SizedBox(height: defaultSize), // TODO: use actual educators when a form that connects everything has been used to connect things up - buildAvatarAndName( + CircularAvatarAndName( // avatar: classwork.clas!.educators![0].avatar, // name: classwork.clas!.educators![0].name, avatar: defaultProfileAvatar, @@ -185,11 +167,11 @@ class TheClassworkCard extends StatelessWidget { // Class Title SizedBox(height: defaultSize * .5), - buildCardHeader(title: classwork.title), + buildCardHeader(context: context, title: classwork.title ?? 'null classwork title'), // Description SizedBox(height: defaultSize), - TextMedium(title: classwork.body ?? '', color: kBlack70), + Text(classwork.body ?? 'null classwork body', style: Theme.of(context).textTheme.bodyMedium,), // Bottom Tablets SizedBox(height: defaultSize * 2.5), @@ -198,16 +180,16 @@ class TheClassworkCard extends StatelessWidget { IconText( title: 'Due August 12 - 3pm', icon: Icons.watch, - iconColor: kBlack70, + iconColor: Theme.of(context).canvasColor.withOpacity(.7), fontSize: defaultSize * 1.4, ), SizedBox( width: defaultSize * 2, ), IconText( - title: '${classwork.clas!.name!}', + title: classwork.clas?.name ?? "null class name", icon: Icons.school, - iconColor: kBlack70, + iconColor: Theme.of(context).canvasColor.withOpacity(.7), fontSize: defaultSize * 1.4, ), ], diff --git a/lib/components/cards/components/card_description.dart b/lib/components/cards/components/card_description.dart index 9c6f234..67ce57a 100644 --- a/lib/components/cards/components/card_description.dart +++ b/lib/components/cards/components/card_description.dart @@ -19,14 +19,11 @@ class CardDescription extends StatelessWidget { children: [ // Label SizedBox(height: defaultSize * 1.5), - TextMedium(title: label, color: kBlack70), + Text(label, style: Theme.of(context).textTheme.bodyMedium,), // Content SizedBox(height: defaultSize * .5), - TextMedium( - title: content, - color: kBlack70, - ), + Text(content, style: Theme.of(context).textTheme.bodyMedium,), ], ); } diff --git a/lib/components/cards/components/card_sections.dart b/lib/components/cards/components/card_sections.dart index 4b33fed..afe3ea6 100644 --- a/lib/components/cards/components/card_sections.dart +++ b/lib/components/cards/components/card_sections.dart @@ -1,80 +1,82 @@ -import 'package:flutter/material.dart'; -import 'package:neocloud_mobile/components/cards/components/seperator.dart'; -import 'package:neocloud_mobile/components/texts.dart'; -import 'package:neocloud_mobile/constraints.dart'; -import 'package:neocloud_mobile/utils/utils.dart'; +// import 'package:flutter/material.dart'; +// import 'package:neocloud_mobile/components/cards/components/seperator.dart'; +// import 'package:neocloud_mobile/components/texts.dart'; +// import 'package:neocloud_mobile/constraints.dart'; +// import 'package:neocloud_mobile/utils/utils.dart'; -// This displays a