168 lines
5.8 KiB
Dart
168 lines
5.8 KiB
Dart
import 'dart:collection';
|
|
|
|
import 'package:aitrainer_app/model/cache.dart';
|
|
import 'package:aitrainer_app/repository/customer_repository.dart';
|
|
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
|
import 'package:aitrainer_app/widgets/app_bar_common.dart';
|
|
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class MyDevelopmentPage extends StatefulWidget {
|
|
@override
|
|
_MyDevelopmentPage createState() => _MyDevelopmentPage();
|
|
}
|
|
|
|
class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final ExerciseRepository exerciseRepository = ExerciseRepository();
|
|
final CustomerRepository customerRepository = CustomerRepository();
|
|
final LinkedHashMap args = LinkedHashMap();
|
|
|
|
return Scaffold(
|
|
appBar: AppBarCommonNav(),
|
|
body: Container(
|
|
padding: EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage('asset/image/WT_light_background.png'),
|
|
fit: BoxFit.cover,
|
|
alignment: Alignment.center,
|
|
),
|
|
),
|
|
child: CustomScrollView(
|
|
scrollDirection: Axis.vertical,
|
|
slivers:
|
|
[
|
|
SliverGrid(
|
|
delegate: SliverChildListDelegate(
|
|
[
|
|
FlatButton(
|
|
padding: EdgeInsets.all(0),
|
|
textColor: Colors.white,
|
|
color: Colors.black12,
|
|
focusColor: Colors.blueAccent,
|
|
onPressed: () =>
|
|
{
|
|
args['exerciseRepository'] = exerciseRepository,
|
|
args['customerRepository'] = customerRepository,
|
|
args['customerId'] = Cache().userLoggedIn.customerId,
|
|
Navigator.of(context).pushNamed('exerciseLogPage',
|
|
arguments: args)
|
|
},
|
|
child: Text("My Exercise Logs",
|
|
style: TextStyle(fontSize: 18),)
|
|
),
|
|
Stack(
|
|
fit: StackFit.passthrough,
|
|
overflow: Overflow.clip,
|
|
alignment: Alignment.topLeft,
|
|
children: [
|
|
Image.asset('asset/image/lock.png',
|
|
height: 40,
|
|
width: 40,
|
|
),
|
|
FlatButton(
|
|
padding: EdgeInsets.all(20),
|
|
textColor: Colors.white,
|
|
color: Colors.black12,
|
|
focusColor: Colors.blueAccent,
|
|
onPressed: () =>
|
|
{
|
|
},
|
|
child: Text("My Whole Body Development",
|
|
style: TextStyle(fontSize: 18),)
|
|
),
|
|
|
|
],
|
|
),
|
|
|
|
Stack(
|
|
fit: StackFit.passthrough,
|
|
overflow: Overflow.clip,
|
|
children: [
|
|
Image.asset('asset/image/lock.png',
|
|
height: 40,
|
|
width: 40,
|
|
),
|
|
FlatButton(
|
|
padding: EdgeInsets.all(20),
|
|
textColor: Colors.white,
|
|
color: Colors.black12,
|
|
focusColor: Colors.blueAccent,
|
|
onPressed: () =>
|
|
{
|
|
},
|
|
child: Text("Development Of Muscles",
|
|
style: TextStyle(fontSize: 18),)
|
|
),
|
|
|
|
]
|
|
),
|
|
Stack(
|
|
fit: StackFit.passthrough,
|
|
|
|
overflow: Overflow.clip,
|
|
children: [
|
|
Image.asset('asset/image/lock.png',
|
|
height: 40,
|
|
width: 40,
|
|
),
|
|
FlatButton(
|
|
padding: EdgeInsets.all(20),
|
|
textColor: Colors.white,
|
|
color: Colors.black12,
|
|
focusColor: Colors.blueAccent,
|
|
onPressed: () =>
|
|
{
|
|
},
|
|
child: Text("Predictions",
|
|
style: TextStyle(fontSize: 18),)
|
|
),
|
|
]
|
|
),
|
|
hiddenWidget(customerRepository, exerciseRepository),
|
|
]
|
|
),
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 2,
|
|
mainAxisSpacing: 20.0,
|
|
crossAxisSpacing: 20.0,
|
|
childAspectRatio: 1.2,
|
|
),
|
|
)
|
|
]
|
|
)
|
|
),
|
|
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1));
|
|
}
|
|
|
|
Widget hiddenWidget(CustomerRepository customerRepository, ExerciseRepository exerciseRepository) {
|
|
final LinkedHashMap args = LinkedHashMap();
|
|
if (Cache().getTrainee() != null) {
|
|
return FlatButton(
|
|
padding: EdgeInsets.all(20),
|
|
textColor: Colors.white,
|
|
color: Colors.black12,
|
|
focusColor: Colors.blueAccent,
|
|
onPressed: () =>
|
|
{
|
|
args['exerciseRepository'] = exerciseRepository,
|
|
args['customerRepository'] = customerRepository,
|
|
args['customerId'] = Cache().getTrainee().customerId,
|
|
Navigator.of(context).pushNamed('exerciseLogPage',
|
|
arguments: args)
|
|
},
|
|
child: Text("My Trainee's Exercise Logs",
|
|
style: TextStyle(fontSize: 18),)
|
|
);
|
|
} else {
|
|
return Container();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|