You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
152 lines
5.2 KiB
Dart
152 lines
5.2 KiB
Dart
import 'dart:ui';
|
|
import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart';
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
import 'AddWeightPage.dart';
|
|
import 'WeightMonthlyPage.dart';
|
|
import 'WeightYeaPage.dart';
|
|
import 'WeightWeeklyPage.dart';
|
|
|
|
class WeightHomePage extends StatefulWidget {
|
|
@override
|
|
_WeightHomePageState createState() => _WeightHomePageState();
|
|
}
|
|
|
|
class _WeightHomePageState extends State<WeightHomePage>
|
|
with SingleTickerProviderStateMixin {
|
|
TabController _tabController;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_tabController = TabController(length: 3, vsync: this);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
_tabController.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<WeightPressureViewMode>(
|
|
onModelReady: (model) => model.getWeight(),
|
|
builder: (_, model, w) => AppScaffold(
|
|
isShowAppBar: true,
|
|
appBarTitle: 'Weight',
|
|
baseViewModel: model,
|
|
body: Scaffold(
|
|
extendBodyBehindAppBar: true,
|
|
appBar: PreferredSize(
|
|
preferredSize: Size.fromHeight(60.0),
|
|
child: Stack(
|
|
children: <Widget>[
|
|
Positioned(
|
|
bottom: 1,
|
|
left: 0,
|
|
right: 0,
|
|
child: BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
|
child: Container(
|
|
color: Theme.of(context)
|
|
.scaffoldBackgroundColor
|
|
.withOpacity(0.8),
|
|
height: 70.0,
|
|
),
|
|
),
|
|
),
|
|
Center(
|
|
child: Container(
|
|
height: 55.0,
|
|
color: Colors.white,
|
|
child: Center(
|
|
child: TabBar(
|
|
isScrollable: true,
|
|
controller: _tabController,
|
|
indicatorWeight: 5.0,
|
|
indicatorSize: TabBarIndicatorSize.label,
|
|
indicatorColor: Colors.red[800],
|
|
labelColor: Theme.of(context).primaryColor,
|
|
labelPadding:
|
|
EdgeInsets.only(top: 4.0, left: 5.0, right: 5.0),
|
|
unselectedLabelColor: Colors.grey[800],
|
|
tabs: [
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.27,
|
|
child: Center(
|
|
child: Texts('Weekly'),
|
|
),
|
|
),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.27,
|
|
child: Center(
|
|
child: Texts('Monthly'),
|
|
),
|
|
),
|
|
Container(
|
|
width: MediaQuery.of(context).size.width * 0.27,
|
|
child: Center(
|
|
child: Texts('Yearly'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
body: Column(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: TabBarView(
|
|
physics: BouncingScrollPhysics(),
|
|
controller: _tabController,
|
|
children: <Widget>[
|
|
WeightWeeklyPage(
|
|
data: model.getWeightWeeklySeries(),
|
|
diabtecPatientResult: model.weekWeightMeasurementResult,
|
|
),
|
|
WeightMonthlyPage(
|
|
data: model.getWeightMonthlyTimeSeriesSales(),
|
|
diabtecPatientResult: model.monthWeightMeasurementResult,
|
|
),
|
|
WeightYearPage(
|
|
data: model.getWeightYearTimeSeriesSales(),
|
|
diabtecPatientResult: model.yearWeightMeasurementResult,
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
floatingActionButton: InkWell(
|
|
onTap: () {
|
|
Navigator.push(context, FadePage(page: AddWeightPage()));
|
|
},
|
|
child: Container(
|
|
width: 55,
|
|
height: 55,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle, color: Hexcolor('515B5D')),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.add,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|