mirror of
https://github.com/supleed2/ELEC60013-ES-CW1.git
synced 2024-12-22 21:45:48 +00:00
Implemented steps page
This commit is contained in:
parent
c810510107
commit
72e6fa0386
|
@ -25,6 +25,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
body: PageView(
|
body: PageView(
|
||||||
controller: _pageController,
|
controller: _pageController,
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:leg_barkr_app/home.dart';
|
import 'package:leg_barkr_app/home.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.black12));
|
||||||
runApp(const Main());
|
runApp(const Main());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
import 'package:leg_barkr_app/model/steps_series.dart';
|
import 'package:leg_barkr_app/model/steps_series.dart';
|
||||||
|
|
||||||
class StepsChart extends StatelessWidget {
|
class StepsChart extends StatelessWidget {
|
||||||
final List<StepsSeries> data;
|
List<StepsSeries> data;
|
||||||
|
|
||||||
StepsChart(this.data);
|
StepsChart(this.data);
|
||||||
|
|
||||||
|
@ -19,7 +19,11 @@ class StepsChart extends StatelessWidget {
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
return new charts.BarChart(series, animate: true,);
|
return Container(
|
||||||
|
height: 600,
|
||||||
|
width: double.infinity,
|
||||||
|
child: charts.BarChart(series, animate: true)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@ import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:leg_barkr_app/model/steps_series.dart';
|
import 'package:leg_barkr_app/model/steps_series.dart';
|
||||||
import 'package:leg_barkr_app/view/steps/steps_chart.dart';
|
import 'package:leg_barkr_app/view/steps/steps_chart.dart';
|
||||||
|
import 'package:leg_barkr_app/view/steps/steps_today.dart';
|
||||||
|
|
||||||
class StepsPage extends StatefulWidget {
|
class StepsPage extends StatefulWidget {
|
||||||
const StepsPage({ Key? key }) : super(key: key);
|
const StepsPage({ Key? key }) : super(key: key);
|
||||||
|
@ -25,12 +26,15 @@ class _StepsPageState extends State<StepsPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return Padding(
|
||||||
home: Scaffold(
|
padding: EdgeInsets.fromLTRB(0.0, 50.0, 10.0, 0.0),
|
||||||
body: Center(
|
child: Column(
|
||||||
child: StepsChart(data)
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
),
|
children: [
|
||||||
),
|
StepsToday(5123),
|
||||||
|
new Expanded(child: StepsChart(data))
|
||||||
|
],
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
22
lib/view/steps/steps_today.dart
Normal file
22
lib/view/steps/steps_today.dart
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class StepsToday extends StatelessWidget {
|
||||||
|
int count;
|
||||||
|
|
||||||
|
StepsToday(this.count);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text("Steps today", style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 20), textAlign: TextAlign.center),
|
||||||
|
Text(count.toString(), style: TextStyle(color: Colors.green, fontWeight: FontWeight.bold, fontSize: 40), textAlign: TextAlign.center)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue