diff --git a/lib/controllers/MenuController.dart b/lib/controllers/MenuController.dart index a29727c..e57de4c 100644 --- a/lib/controllers/MenuController.dart +++ b/lib/controllers/MenuController.dart @@ -6,8 +6,8 @@ class MenuController extends ChangeNotifier { GlobalKey get scaffoldKey => _scaffoldKey; void controlMenu() { - if (!_scaffoldKey.currentState.isDrawerOpen) { - _scaffoldKey.currentState.openDrawer(); + if (!_scaffoldKey.currentState!.isDrawerOpen) { + _scaffoldKey.currentState!.openDrawer(); } } } diff --git a/lib/models/MyFiles.dart b/lib/models/MyFiles.dart index 4dfc97a..b3df1ae 100644 --- a/lib/models/MyFiles.dart +++ b/lib/models/MyFiles.dart @@ -2,23 +2,24 @@ import 'package:admin/constants.dart'; import 'package:flutter/material.dart'; class CloudStorageInfo { - final String svgSrc, title, totalStorage; - final int numOfFiels, percentage; - final Color color; + final String? svgSrc, title, totalStorage; + final int? numOfFiles, percentage; + final Color? color; - CloudStorageInfo( - {this.svgSrc, - this.title, - this.totalStorage, - this.numOfFiels, - this.percentage, - this.color}); + CloudStorageInfo({ + this.svgSrc, + this.title, + this.totalStorage, + this.numOfFiles, + this.percentage, + this.color, + }); } -List demoMyFiels = [ +List demoMyFiles = [ CloudStorageInfo( title: "Documents", - numOfFiels: 1328, + numOfFiles: 1328, svgSrc: "assets/icons/Documents.svg", totalStorage: "1.9GB", color: primaryColor, @@ -26,7 +27,7 @@ List demoMyFiels = [ ), CloudStorageInfo( title: "Google Drive", - numOfFiels: 1328, + numOfFiles: 1328, svgSrc: "assets/icons/google_drive.svg", totalStorage: "2.9GB", color: Color(0xFFFFA113), @@ -34,7 +35,7 @@ List demoMyFiels = [ ), CloudStorageInfo( title: "One Drive", - numOfFiels: 1328, + numOfFiles: 1328, svgSrc: "assets/icons/one_drive.svg", totalStorage: "1GB", color: Color(0xFFA4CDFF), @@ -42,7 +43,7 @@ List demoMyFiels = [ ), CloudStorageInfo( title: "Documents", - numOfFiels: 5328, + numOfFiles: 5328, svgSrc: "assets/icons/drop_box.svg", totalStorage: "7.3GB", color: Color(0xFF007EE5), diff --git a/lib/models/RecentFile.dart b/lib/models/RecentFile.dart index e2a7b64..f1f29c5 100644 --- a/lib/models/RecentFile.dart +++ b/lib/models/RecentFile.dart @@ -1,5 +1,5 @@ class RecentFile { - final String icon, title, date, size; + final String? icon, title, date, size; RecentFile({this.icon, this.title, this.date, this.size}); } diff --git a/lib/responsive.dart b/lib/responsive.dart index af474ef..33545cd 100644 --- a/lib/responsive.dart +++ b/lib/responsive.dart @@ -2,14 +2,14 @@ import 'package:flutter/material.dart'; class Responsive extends StatelessWidget { final Widget mobile; - final Widget tablet; + final Widget? tablet; final Widget desktop; const Responsive({ - Key key, - @required this.mobile, + Key? key, + required this.mobile, this.tablet, - @required this.desktop, + required this.desktop, }) : super(key: key); // This size work fine on my design, maybe you need some customization depends on your design @@ -34,7 +34,7 @@ class Responsive extends StatelessWidget { } // If width it less then 1100 and more then 850 we consider it as tablet else if (_size.width >= 850 && tablet != null) { - return tablet; + return tablet!; } // Or less then that we called it mobile else { diff --git a/lib/screens/dashboard/components/chart.dart b/lib/screens/dashboard/components/chart.dart index 6b931b0..bbc1109 100644 --- a/lib/screens/dashboard/components/chart.dart +++ b/lib/screens/dashboard/components/chart.dart @@ -5,7 +5,7 @@ import '../../../constants.dart'; class Chart extends StatelessWidget { const Chart({ - Key key, + Key? key, }) : super(key: key); @override @@ -29,7 +29,7 @@ class Chart extends StatelessWidget { SizedBox(height: defaultPadding), Text( "29.1", - style: Theme.of(context).textTheme.headline4.copyWith( + style: Theme.of(context).textTheme.headline4!.copyWith( color: Colors.white, fontWeight: FontWeight.w600, height: 0.5, diff --git a/lib/screens/dashboard/components/file_info_card.dart b/lib/screens/dashboard/components/file_info_card.dart index 85e6d43..912a597 100644 --- a/lib/screens/dashboard/components/file_info_card.dart +++ b/lib/screens/dashboard/components/file_info_card.dart @@ -6,8 +6,8 @@ import '../../../constants.dart'; class FileInfoCard extends StatelessWidget { const FileInfoCard({ - Key key, - @required this.info, + Key? key, + required this.info, }) : super(key: key); final CloudStorageInfo info; @@ -32,11 +32,11 @@ class FileInfoCard extends StatelessWidget { height: 40, width: 40, decoration: BoxDecoration( - color: info.color.withOpacity(0.1), + color: info.color!.withOpacity(0.1), borderRadius: const BorderRadius.all(Radius.circular(10)), ), child: SvgPicture.asset( - info.svgSrc, + info.svgSrc!, color: info.color, ), ), @@ -44,7 +44,7 @@ class FileInfoCard extends StatelessWidget { ], ), Text( - info.title, + info.title!, maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -56,17 +56,17 @@ class FileInfoCard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - "${info.numOfFiels} Files", + "${info.numOfFiles} Files", style: Theme.of(context) .textTheme - .caption + .caption! .copyWith(color: Colors.white70), ), Text( - info.totalStorage, + info.totalStorage!, style: Theme.of(context) .textTheme - .caption + .caption! .copyWith(color: Colors.white), ), ], @@ -79,13 +79,13 @@ class FileInfoCard extends StatelessWidget { class ProgressLine extends StatelessWidget { const ProgressLine({ - Key key, + Key? key, this.color = primaryColor, - @required this.percentage, + required this.percentage, }) : super(key: key); - final Color color; - final int percentage; + final Color? color; + final int? percentage; @override Widget build(BuildContext context) { @@ -95,13 +95,13 @@ class ProgressLine extends StatelessWidget { width: double.infinity, height: 5, decoration: BoxDecoration( - color: color.withOpacity(0.1), + color: color!.withOpacity(0.1), borderRadius: BorderRadius.all(Radius.circular(10)), ), ), LayoutBuilder( builder: (context, constraints) => Container( - width: constraints.maxWidth * (percentage / 100), + width: constraints.maxWidth * (percentage! / 100), height: 5, decoration: BoxDecoration( color: color, diff --git a/lib/screens/dashboard/components/header.dart b/lib/screens/dashboard/components/header.dart index 917801e..9962cd3 100644 --- a/lib/screens/dashboard/components/header.dart +++ b/lib/screens/dashboard/components/header.dart @@ -8,7 +8,7 @@ import '../../../constants.dart'; class Header extends StatelessWidget { const Header({ - Key key, + Key? key, }) : super(key: key); @override @@ -36,7 +36,7 @@ class Header extends StatelessWidget { class ProfileCard extends StatelessWidget { const ProfileCard({ - Key key, + Key? key, }) : super(key: key); @override @@ -73,7 +73,7 @@ class ProfileCard extends StatelessWidget { class SearchField extends StatelessWidget { const SearchField({ - Key key, + Key? key, }) : super(key: key); @override diff --git a/lib/screens/dashboard/components/my_fiels.dart b/lib/screens/dashboard/components/my_fields.dart similarity index 93% rename from lib/screens/dashboard/components/my_fiels.dart rename to lib/screens/dashboard/components/my_fields.dart index 772a163..685444f 100644 --- a/lib/screens/dashboard/components/my_fiels.dart +++ b/lib/screens/dashboard/components/my_fields.dart @@ -5,9 +5,9 @@ import 'package:flutter/material.dart'; import '../../../constants.dart'; import 'file_info_card.dart'; -class MyFiels extends StatelessWidget { - const MyFiels({ - Key key, +class MyFiles extends StatelessWidget { + const MyFiles({ + Key? key, }) : super(key: key); @override @@ -54,7 +54,7 @@ class MyFiels extends StatelessWidget { class FileInfoCardGridView extends StatelessWidget { const FileInfoCardGridView({ - Key key, + Key? key, this.crossAxisCount = 4, this.childAspectRatio = 1, }) : super(key: key); @@ -67,14 +67,14 @@ class FileInfoCardGridView extends StatelessWidget { return GridView.builder( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, - itemCount: demoMyFiels.length, + itemCount: demoMyFiles.length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: crossAxisCount, crossAxisSpacing: defaultPadding, mainAxisSpacing: defaultPadding, childAspectRatio: childAspectRatio, ), - itemBuilder: (context, index) => FileInfoCard(info: demoMyFiels[index]), + itemBuilder: (context, index) => FileInfoCard(info: demoMyFiles[index]), ); } } diff --git a/lib/screens/dashboard/components/my_files.dart b/lib/screens/dashboard/components/my_files.dart new file mode 100644 index 0000000..77b828d --- /dev/null +++ b/lib/screens/dashboard/components/my_files.dart @@ -0,0 +1,80 @@ + +import 'package:admin/responsive.dart'; +import 'package:flutter/material.dart'; +import 'package:admin/models/MyFiles.dart'; +import '../../../constants.dart'; +import 'file_info_card.dart'; + +class MyFiles extends StatelessWidget { + const MyFiles({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final Size _size = MediaQuery.of(context).size; + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "My Files", + style: Theme.of(context).textTheme.subtitle1, + ), + ElevatedButton.icon( + style: TextButton.styleFrom( + padding: EdgeInsets.symmetric( + horizontal: defaultPadding * 1.5, + vertical: + defaultPadding / (Responsive.isMobile(context) ? 2 : 1), + ), + ), + onPressed: () {}, + icon: Icon(Icons.add), + label: Text("Add New"), + ), + ], + ), + SizedBox(height: defaultPadding), + Responsive( + mobile: FileInfoCardGridView( + crossAxisCount: _size.width < 650 ? 2 : 4, + childAspectRatio: _size.width < 650 ? 1.3 : 1, + ), + tablet: FileInfoCardGridView(), + desktop: FileInfoCardGridView( + childAspectRatio: _size.width < 1400 ? 1.1 : 1.4, + ), + ), + ], + ); + } +} + +class FileInfoCardGridView extends StatelessWidget { + const FileInfoCardGridView({ + Key? key, + this.crossAxisCount = 4, + this.childAspectRatio = 1, + }) : super(key: key); + + final int crossAxisCount; + final double childAspectRatio; + + @override + Widget build(BuildContext context) { + return GridView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: demoMyFiles.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: crossAxisCount, + crossAxisSpacing: defaultPadding, + mainAxisSpacing: defaultPadding, + childAspectRatio: childAspectRatio, + ), + itemBuilder: (context, index) => FileInfoCard(info: demoMyFiles[index]), + ); + } +} diff --git a/lib/screens/dashboard/components/recent_files.dart b/lib/screens/dashboard/components/recent_files.dart index a9d8b5b..5043cdf 100644 --- a/lib/screens/dashboard/components/recent_files.dart +++ b/lib/screens/dashboard/components/recent_files.dart @@ -6,7 +6,7 @@ import '../../../constants.dart'; class RecentFiles extends StatelessWidget { const RecentFiles({ - Key key, + Key? key, }) : super(key: key); @override @@ -59,19 +59,19 @@ DataRow recentFileDataRow(RecentFile fileInfo) { Row( children: [ SvgPicture.asset( - fileInfo.icon, + fileInfo.icon!, height: 30, width: 30, ), Padding( padding: const EdgeInsets.symmetric(horizontal: defaultPadding), - child: Text(fileInfo.title), + child: Text(fileInfo.title!), ), ], ), ), - DataCell(Text(fileInfo.date)), - DataCell(Text(fileInfo.size)), + DataCell(Text(fileInfo.date!)), + DataCell(Text(fileInfo.size!)), ], ); } diff --git a/lib/screens/dashboard/components/storage_details.dart b/lib/screens/dashboard/components/storage_details.dart index d19b09b..e8205c5 100644 --- a/lib/screens/dashboard/components/storage_details.dart +++ b/lib/screens/dashboard/components/storage_details.dart @@ -6,7 +6,7 @@ import 'storage_info_card.dart'; class StarageDetails extends StatelessWidget { const StarageDetails({ - Key key, + Key? key, }) : super(key: key); @override diff --git a/lib/screens/dashboard/components/storage_info_card.dart b/lib/screens/dashboard/components/storage_info_card.dart index 23682b9..d1c8f38 100644 --- a/lib/screens/dashboard/components/storage_info_card.dart +++ b/lib/screens/dashboard/components/storage_info_card.dart @@ -5,11 +5,11 @@ import '../../../constants.dart'; class StorageInfoCard extends StatelessWidget { const StorageInfoCard({ - Key key, - @required this.title, - @required this.svgSrc, - @required this.amountOfFiles, - @required this.numOfFiles, + Key? key, + required this.title, + required this.svgSrc, + required this.amountOfFiles, + required this.numOfFiles, }) : super(key: key); final String title, svgSrc, amountOfFiles; @@ -48,7 +48,7 @@ class StorageInfoCard extends StatelessWidget { "$numOfFiles Files", style: Theme.of(context) .textTheme - .caption + .caption! .copyWith(color: Colors.white70), ), ], diff --git a/lib/screens/dashboard/dashboard_screen.dart b/lib/screens/dashboard/dashboard_screen.dart index 093745a..26834ee 100644 --- a/lib/screens/dashboard/dashboard_screen.dart +++ b/lib/screens/dashboard/dashboard_screen.dart @@ -1,9 +1,10 @@ import 'package:admin/responsive.dart'; +import 'package:admin/screens/dashboard/components/my_fields.dart'; import 'package:flutter/material.dart'; import '../../constants.dart'; import 'components/header.dart'; -import 'components/my_fiels.dart'; + import 'components/recent_files.dart'; import 'components/storage_details.dart'; @@ -24,7 +25,7 @@ class DashboardScreen extends StatelessWidget { flex: 5, child: Column( children: [ - MyFiels(), + MyFiles(), SizedBox(height: defaultPadding), RecentFiles(), if (Responsive.isMobile(context)) diff --git a/lib/screens/main/components/side_menu.dart b/lib/screens/main/components/side_menu.dart index b8fea0c..53e3c0a 100644 --- a/lib/screens/main/components/side_menu.dart +++ b/lib/screens/main/components/side_menu.dart @@ -3,61 +3,58 @@ import 'package:flutter_svg/flutter_svg.dart'; class SideMenu extends StatelessWidget { const SideMenu({ - Key key, + Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return Drawer( - child: SingleChildScrollView( - // it enables scrolling - child: Column( - children: [ - DrawerHeader( - child: Image.asset("assets/images/logo.png"), - ), - DrawerListTile( - title: "Dashbord", - svgSrc: "assets/icons/menu_dashbord.svg", - press: () {}, - ), - DrawerListTile( - title: "Transaction", - svgSrc: "assets/icons/menu_tran.svg", - press: () {}, - ), - DrawerListTile( - title: "Task", - svgSrc: "assets/icons/menu_task.svg", - press: () {}, - ), - DrawerListTile( - title: "Documents", - svgSrc: "assets/icons/menu_doc.svg", - press: () {}, - ), - DrawerListTile( - title: "Store", - svgSrc: "assets/icons/menu_store.svg", - press: () {}, - ), - DrawerListTile( - title: "Notification", - svgSrc: "assets/icons/menu_notification.svg", - press: () {}, - ), - DrawerListTile( - title: "Profile", - svgSrc: "assets/icons/menu_profile.svg", - press: () {}, - ), - DrawerListTile( - title: "Settings", - svgSrc: "assets/icons/menu_setting.svg", - press: () {}, - ), - ], - ), + child: ListView( + children: [ + DrawerHeader( + child: Image.asset("assets/images/logo.png"), + ), + DrawerListTile( + title: "Dashbord", + svgSrc: "assets/icons/menu_dashbord.svg", + press: () {}, + ), + DrawerListTile( + title: "Transaction", + svgSrc: "assets/icons/menu_tran.svg", + press: () {}, + ), + DrawerListTile( + title: "Task", + svgSrc: "assets/icons/menu_task.svg", + press: () {}, + ), + DrawerListTile( + title: "Documents", + svgSrc: "assets/icons/menu_doc.svg", + press: () {}, + ), + DrawerListTile( + title: "Store", + svgSrc: "assets/icons/menu_store.svg", + press: () {}, + ), + DrawerListTile( + title: "Notification", + svgSrc: "assets/icons/menu_notification.svg", + press: () {}, + ), + DrawerListTile( + title: "Profile", + svgSrc: "assets/icons/menu_profile.svg", + press: () {}, + ), + DrawerListTile( + title: "Settings", + svgSrc: "assets/icons/menu_setting.svg", + press: () {}, + ), + ], ), ); } @@ -65,11 +62,11 @@ class SideMenu extends StatelessWidget { class DrawerListTile extends StatelessWidget { const DrawerListTile({ - Key key, + Key? key, // For selecting those three line once press "Command+D" - @required this.title, - @required this.svgSrc, - @required this.press, + required this.title, + required this.svgSrc, + required this.press, }) : super(key: key); final String title, svgSrc; diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 5c30a0b..328ddd1 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -19,4 +19,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c -COCOAPODS: 1.10.0 +COCOAPODS: 1.10.1 diff --git a/pubspec.lock b/pubspec.lock index 1c7d098..b2f5a56 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.6.1" boolean_selector: dependency: transitive description: @@ -56,14 +56,14 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.3" equatable: dependency: transitive description: name: equatable url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.2" fake_async: dependency: transitive description: @@ -77,21 +77,21 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.1" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.0" + version: "6.1.1" fl_chart: dependency: "direct main" description: name: fl_chart url: "https://pub.dartlang.org" source: hosted - version: "0.35.0" + version: "0.36.1" flutter: dependency: "direct main" description: flutter @@ -115,14 +115,14 @@ packages: name: google_fonts url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" http: dependency: transitive description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.13.2" + version: "0.13.3" http_parser: dependency: transitive description: @@ -164,21 +164,21 @@ packages: name: path_drawing url: "https://pub.dartlang.org" source: hosted - version: "0.5.0" + version: "0.5.1" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.1" path_provider: dependency: transitive description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.2" path_provider_linux: dependency: transitive description: @@ -260,7 +260,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -295,7 +295,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.3.0" typed_data: dependency: transitive description: @@ -316,7 +316,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.1" xdg_directories: dependency: transitive description: @@ -330,7 +330,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.1.0" + version: "5.1.1" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.13.0 <3.0.0" flutter: ">=1.24.0-7.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3fa64c1..c36f432 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: @@ -26,11 +26,11 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.2 + cupertino_icons: ^1.0.3 - google_fonts: ^2.0.0 + google_fonts: ^2.1.0 flutter_svg: ^0.22.0 - fl_chart: ^0.35.0 + fl_chart: ^0.36.1 provider: ^5.0.0 dev_dependencies: