Skip to content

Instantly share code, notes, and snippets.

@VB10
Created September 8, 2019 13:57
Show Gist options
  • Select an option

  • Save VB10/2dc51847699ec7b90cbbd432dc835519 to your computer and use it in GitHub Desktop.

Select an option

Save VB10/2dc51847699ec7b90cbbd432dc835519 to your computer and use it in GitHub Desktop.
healtho tips
List<HealthTips> listHealthTips = [];
@override
void initState() {
super.initState();
listHealthTips.add(HealthTips(
title: "A Diet Without Exercise is Useless. ",
subTitle: " Interval Training is a form of exercise in which"
"you alternate between two or more different "
"exercise . This Consist of doing an exercise at"
"a very high level intensity for a short bursts.",
image: UIHelper.PERSONAL_TRAINER));
}
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: 5,
padding: EdgeInsets.all(10),
shrinkWrap: true,
//We have single value so set just zero.
itemBuilder: (context, index) => _card(listHealthTips[0]),
);
}
Widget _card(HealthTips tips) => InkWell(
onTap: () => Navigator.of(context)
.pushNamed("/healthTipsDetail", arguments: tips),
child: Card(
margin: EdgeInsets.only(top: UIHelper.Space20),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(UIHelper.Space20),
bottomRight: Radius.circular(UIHelper.Space20))),
child: Container(
height: UIHelper.Space250,
child: Stack(
children: <Widget>[
Positioned.fill(
// Container height - 20
top: UIHelper.Space80,
child: Image.asset(tips.image, fit: BoxFit.fill)),
Container(
height: UIHelper.Space100,
decoration: BoxDecoration(
color: UIHelper.SETTINGS_CARD_BACKGROUND_COLOR,
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(UIHelper.Space10),
top: Radius.circular(UIHelper.Space10),
),
),
child: ListTile(
title: Text(tips.title),
subtitle: Text(tips.subTitle, maxLines: 2),
),
)
],
),
),
),
);
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
backgroundColor: UIHelper.SETTINGS_APP_BAR_COLOR,
automaticallyImplyLeading: false,
elevation: 10,
flexibleSpace: FlexibleSpaceBar(
titlePadding: EdgeInsets.all(0),
centerTitle: false,
title: TabBar(
indicatorColor: Colors.yellow,
indicatorWeight: 1,
indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: EdgeInsets.only(bottom: 0),
labelColor: Colors.yellow,
unselectedLabelColor: Colors.white,
isScrollable: true,
tabs: [
Tab(text: Constants.HEALTH_TIPS),
Tab(text: Constants.HEALTH_EXERCISES),
Tab(text: Constants.HEALTH_WORKOUT_PLAN),
],
),
),
),
body: TabBarView(
children: [
HealthTipsView(),
ExerciseView(),
Icon(Icons.directions_bike),
],
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment