forked from Santos-Enoque/flutter-web-dashboard-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5132ec
commit 1824a68
Showing
10 changed files
with
308 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,59 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_web_dashboard/constants/style.dart'; | ||
import 'package:flutter_web_dashboard/helpers/reponsiveness.dart'; | ||
import 'package:flutter_web_dashboard/constants/controllers.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/bar_chart.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/overview_cards_large.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/overview_cards_medium.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/overview_cards_small.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/revenue_info.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/revenue_section_large.dart'; | ||
import 'package:flutter_web_dashboard/widgets/custom_text.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class OverviewPage extends StatelessWidget { | ||
import 'widgets/revenue_section_small.dart'; | ||
|
||
class OverviewPage extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: [ | ||
Obx( | ||
() => Row( | ||
children: [ | ||
Container( | ||
margin: EdgeInsets.only( | ||
top: ResponsiveWidget.isSmallScreen(context) ? 56 : 6), | ||
child: CustomText( | ||
text: menuController.activeItem.value, | ||
size: 24, | ||
weight: FontWeight.bold, | ||
)), | ||
], | ||
), | ||
return Container( | ||
child: Column( | ||
children: [ | ||
Obx( | ||
() => Row( | ||
children: [ | ||
Container( | ||
margin: EdgeInsets.only( | ||
top: ResponsiveWidget.isSmallScreen(context) ? 56 : 6), | ||
child: CustomText( | ||
text: menuController.activeItem.value, | ||
size: 24, | ||
weight: FontWeight.bold, | ||
)), | ||
], | ||
), | ||
Expanded(child: ListView(children: [ | ||
if(ResponsiveWidget.isLargeScreen(context) || ResponsiveWidget.isMediumScreen(context)) | ||
if(ResponsiveWidget.isCustomSize(context)) | ||
OverviewCardsMediumScreen() | ||
else | ||
OverviewCardsLargeScreen() | ||
else | ||
OverviewCardsSmallScreen(), | ||
|
||
|
||
|
||
|
||
Text(MediaQuery.of(context).size.width.toString(), | ||
style: TextStyle(fontSize: 39)) | ||
],)) | ||
], | ||
); | ||
), | ||
Expanded( | ||
child: ListView( | ||
children: [ | ||
if (ResponsiveWidget.isLargeScreen(context) || | ||
ResponsiveWidget.isMediumScreen(context)) | ||
if (ResponsiveWidget.isCustomSize(context)) | ||
OverviewCardsMediumScreen() | ||
else | ||
OverviewCardsLargeScreen() | ||
else | ||
OverviewCardsSmallScreen(), | ||
if (!ResponsiveWidget.isSmallScreen(context)) | ||
RevenueSectionLarge() | ||
else | ||
RevenueSectionSmall(), | ||
Text(MediaQuery.of(context).size.width.toString(), | ||
style: TextStyle(fontSize: 39)) | ||
], | ||
)) | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/// Bar chart example | ||
import 'package:charts_flutter/flutter.dart' as charts; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_web_dashboard/constants/style.dart'; | ||
|
||
class SimpleBarChart extends StatelessWidget { | ||
final List<charts.Series> seriesList; | ||
final bool animate; | ||
|
||
SimpleBarChart(this.seriesList, {this.animate}); | ||
|
||
/// Creates a [BarChart] with sample data and no transition. | ||
factory SimpleBarChart.withSampleData() { | ||
return new SimpleBarChart( | ||
_createSampleData(), | ||
// Disable animations for image tests. | ||
animate: false, | ||
); | ||
} | ||
|
||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return new charts.BarChart( | ||
seriesList, | ||
animate: animate, | ||
); | ||
} | ||
|
||
/// Create one series with sample hard coded data. | ||
static List<charts.Series<OrdinalSales, String>> _createSampleData() { | ||
final data = [ | ||
new OrdinalSales('Today', 55), | ||
new OrdinalSales('Yesterday', 25), | ||
new OrdinalSales('2 days', 100), | ||
new OrdinalSales('24 Jun', 75), | ||
new OrdinalSales('23 Jun', 15), | ||
new OrdinalSales('22 Jun', 85), | ||
new OrdinalSales('21 Jun', 45), | ||
|
||
]; | ||
|
||
return [ | ||
new charts.Series<OrdinalSales, String>( | ||
id: 'Sales', | ||
colorFn: (_, __) => charts.ColorUtil.fromDartColor(active), | ||
domainFn: (OrdinalSales sales, _) => sales.year, | ||
measureFn: (OrdinalSales sales, _) => sales.sales, | ||
data: data, | ||
) | ||
]; | ||
} | ||
} | ||
|
||
/// Sample ordinal data type. | ||
class OrdinalSales { | ||
final String year; | ||
final int sales; | ||
|
||
OrdinalSales(this.year, this.sales); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_web_dashboard/constants/style.dart'; | ||
|
||
class RevenueInfo extends StatelessWidget { | ||
final String title; | ||
final String amount; | ||
|
||
const RevenueInfo({Key key, this.title, this.amount}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Expanded( | ||
child: RichText( | ||
textAlign: TextAlign.center, | ||
text: TextSpan(children: [ | ||
TextSpan( | ||
text: "$title \n\n", | ||
style: TextStyle(color: lightGrey, fontSize: 16)), | ||
TextSpan( | ||
text: "\$ $amount", | ||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)), | ||
])), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_web_dashboard/constants/style.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/bar_chart.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/revenue_info.dart'; | ||
import 'package:flutter_web_dashboard/widgets/custom_text.dart'; | ||
|
||
class RevenueSectionLarge extends StatelessWidget { | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
padding: EdgeInsets.all(24), | ||
margin: EdgeInsets.symmetric(vertical: 30), | ||
decoration: BoxDecoration( | ||
color: Colors.white, | ||
borderRadius: BorderRadius.circular(8), | ||
boxShadow: [ | ||
BoxShadow( | ||
offset: Offset(0, 6), | ||
color: lightGrey.withOpacity(.1), | ||
blurRadius: 12) | ||
], | ||
border: Border.all(color: lightGrey, width: .5), | ||
), | ||
child: Row( | ||
children: [ | ||
Expanded( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
CustomText( | ||
text: "Revenue Chart", | ||
size: 20, | ||
weight: FontWeight.bold, | ||
color: lightGrey, | ||
), | ||
Container( | ||
width: 600, | ||
height: 200, | ||
child: SimpleBarChart.withSampleData()), | ||
], | ||
), | ||
), | ||
Container( | ||
width: 1, | ||
height: 120, | ||
color: lightGrey, | ||
), | ||
Expanded( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
Row( | ||
children: [ | ||
RevenueInfo( | ||
title: "Toda\'s revenue", | ||
amount: "230", | ||
), | ||
RevenueInfo( | ||
title: "Last 7 days", | ||
amount: "1,100", | ||
), | ||
], | ||
), | ||
SizedBox(height: 30,), | ||
Row( | ||
children: [ | ||
RevenueInfo( | ||
title: "Last 30 days", | ||
amount: "3,230", | ||
), | ||
RevenueInfo( | ||
title: "Last 12 months", | ||
amount: "11,300", | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_web_dashboard/constants/style.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/bar_chart.dart'; | ||
import 'package:flutter_web_dashboard/pages/overview/widgets/revenue_info.dart'; | ||
import 'package:flutter_web_dashboard/widgets/custom_text.dart'; | ||
|
||
class RevenueSectionSmall extends StatelessWidget { | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
padding: EdgeInsets.all(24), | ||
margin: EdgeInsets.symmetric(vertical: 30), | ||
decoration: BoxDecoration( | ||
color: Colors.white, | ||
borderRadius: BorderRadius.circular(8), | ||
boxShadow: [ | ||
BoxShadow( | ||
offset: Offset(0, 6), | ||
color: lightGrey.withOpacity(.1), | ||
blurRadius: 12) | ||
], | ||
border: Border.all(color: lightGrey, width: .5), | ||
), | ||
child: Column( | ||
children: [ | ||
Container( | ||
height: 260, | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
CustomText( | ||
text: "Revenue Chart", | ||
size: 20, | ||
weight: FontWeight.bold, | ||
color: lightGrey, | ||
), | ||
Container( | ||
width: 600, | ||
height: 200, | ||
child: SimpleBarChart.withSampleData()), | ||
], | ||
), | ||
), | ||
Container( | ||
width: 120, | ||
height: 1, | ||
color: lightGrey, | ||
), | ||
Container( | ||
height: 260, | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
Row( | ||
children: [ | ||
RevenueInfo( | ||
title: "Toda\'s revenue", | ||
amount: "230", | ||
), | ||
RevenueInfo( | ||
title: "Last 7 days", | ||
amount: "1,100", | ||
), | ||
], | ||
), | ||
Row( | ||
children: [ | ||
RevenueInfo( | ||
title: "Last 30 days", | ||
amount: "3,230", | ||
), | ||
RevenueInfo( | ||
title: "Last 12 months", | ||
amount: "11,300", | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.