Static Nav Drawer in landscape

This commit is contained in:
Sewmina
2022-04-25 15:01:05 +05:30
parent 9f5ef1a7f1
commit 8af736fab1
11 changed files with 507 additions and 366 deletions

View File

@@ -44,65 +44,78 @@ class _AnalyticsPageState extends State<AnalyticsPage> {
// for (var value in avgActs) {
// Debug.LogResponse('${value.taskType.name} : ${DateFormat('HH:mm').format(value.startTime)} - ${DateFormat('HH:mm').format(value.endTime)}');
// }
bool landscape=((MediaQuery.of(context).size.width / MediaQuery.of(context).size.height) > 1);
return Scaffold(
appBar: AppBar(title: Row(
children: [FaIcon(FontAwesomeIcons.chartLine),SizedBox(width: 15,), Text("Analytics")],
)),
drawer: navDrawer(context, 1),
body: Container(
padding: EdgeInsets.all(8),
child:Column(
children: [
Card(
drawer: landscape ? null : navDrawer(context, 1),
body: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
landscape?navDrawer(context, 1) : Container(),
Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 5),
child: Column(
padding: EdgeInsets.all(8),
child:Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Average Day',style: TextStyle(fontSize: 17)),
MaterialButton(
color: Colors.green,
onPressed: (){
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> AvgDayPage()));
},
child: Text('More...'),
)
],
),
Divider(),
Container(
height: 400,
padding: EdgeInsets.all(10),
child: Padding(
padding: EdgeInsets.all(8),
child: (!days.isEmpty)
? Column(
Card(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 5),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Average Day',style: TextStyle(fontSize: 17)),
MaterialButton(
Expanded(
child: SfCircularChart(legend: Legend(isVisible: true,position: LegendPosition.bottom,overflowMode: LegendItemOverflowMode.wrap), series: <CircularSeries>[
// Render pie chart
PieSeries<CatMapData, String>(
dataSource: avgDayData,
pointColorMapper: (CatMapData data, _) => data.color,
xValueMapper: (CatMapData data, _) => data.name,
yValueMapper: (CatMapData data, _) => data.time,
dataLabelMapper: (CatMapData sales, _) => MinutesToTimeString(sales.time),
dataLabelSettings: DataLabelSettings(isVisible: true, useSeriesColor: true, overflowMode: OverflowMode.shift, showZeroValue: false))
]))
color: Colors.green,
onPressed: (){
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> AvgDayPage()));
},
child: Text('More...'),
)
],
)
: Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center, children: [CircularProgressIndicator()]))),
),
Divider(),
Container(
height: 400,
padding: EdgeInsets.all(10),
child: Padding(
padding: EdgeInsets.all(8),
child: (!days.isEmpty)
? Column(
children: [
Expanded(
child: SfCircularChart(legend: Legend(isVisible: true,position: LegendPosition.bottom,overflowMode: LegendItemOverflowMode.wrap), series: <CircularSeries>[
// Render pie chart
PieSeries<CatMapData, String>(
dataSource: avgDayData,
pointColorMapper: (CatMapData data, _) => data.color,
xValueMapper: (CatMapData data, _) => data.name,
yValueMapper: (CatMapData data, _) => data.time,
dataLabelMapper: (CatMapData sales, _) => MinutesToTimeString(sales.time),
dataLabelSettings: DataLabelSettings(isVisible: true, useSeriesColor: true, overflowMode: OverflowMode.shift, showZeroValue: false))
]))
],
)
: Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center, children: [CircularProgressIndicator()]))),
],
),
)
)
],
),
)
)
],
)
)
),
),
),
],
)
);
}