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.
PatientApp-KKUMC/lib/pages/medical/smart_watch_health_data/stepsTracker.dart

92 lines
2.5 KiB
Dart

import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
class StepsTracker extends StatefulWidget {
@override
_StepsTrackerState createState() => _StepsTrackerState();
}
class _StepsTrackerState extends State<StepsTracker>
with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
_tabController = new TabController(length: 3, vsync: this);
WidgetsBinding.instance.addPostFrameCallback((_) {
getYearlyStepsData();
});
super.initState();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: "Steps",
isShowDecPage: false,
body: Container(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
TabBar(
tabs: [
Tab(text: TranslationBase.of(context).weekly),
Tab(text: TranslationBase.of(context).monthly),
Tab(text: TranslationBase.of(context).yearly),
],
controller: _tabController,
),
Expanded(
child: new TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
getWeeklyStepsDetails(),
getMonthlyStepsDetails(),
getYearlyStepsDetails()
],
controller: _tabController,
),
),
],
),
),
);
}
getYearlyStepsData() {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.getPatientHealthDataStats(6, 3, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
print(res['Med_GetYearStepsTransactionsStsList']);
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
getWeeklyStepsDetails() {
return Container(
child: Text("Weekly"),
);
}
getMonthlyStepsDetails() {
return Container(
child: Text("Monthly"),
);
}
getYearlyStepsDetails() {
return Container(
child: Text("Yearly"),
);
}
}