SHARE
TWEET

Untitled

a guest Sep 19th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. List<HealthTips> listHealthTips = [];
  2.   @override
  3.   void initState() {
  4.     super.initState();
  5.  
  6.     listHealthTips.add(HealthTips(
  7.         title: "A Diet Without Exercise is Useless. ",
  8.         subTitle: " Interval Training is a form of exercise in which"
  9.             "you alternate between two or more different "
  10.             "exercise . This Consist of doing an exercise at"
  11.             "a very high  level intensity for a short bursts.",
  12.         image: UIHelper.PERSONAL_TRAINER));
  13.   }
  14.  
  15.   @override
  16.   Widget build(BuildContext context) {
  17.     return ListView.builder(
  18.       itemCount: 5,
  19.       padding: EdgeInsets.all(10),
  20.       shrinkWrap: true,
  21.       //We have single value so set just zero.
  22.       itemBuilder: (context, index) => _card(listHealthTips[0]),
  23.     );
  24.   }
  25.  
  26.   Widget _card(HealthTips tips) => InkWell(
  27.         onTap: () => Navigator.of(context)
  28.             .pushNamed("/healthTipsDetail", arguments: tips),
  29.         child: Card(
  30.           margin: EdgeInsets.only(top: UIHelper.Space20),
  31.           shape: RoundedRectangleBorder(
  32.               borderRadius: BorderRadius.only(
  33.                   bottomLeft: Radius.circular(UIHelper.Space20),
  34.                   bottomRight: Radius.circular(UIHelper.Space20))),
  35.           child: Container(
  36.             height: UIHelper.Space250,
  37.             child: Stack(
  38.               children: <Widget>[
  39.                 Positioned.fill(
  40.                     // Container height - 20
  41.                     top: UIHelper.Space80,
  42.                     child: Image.asset(tips.image, fit: BoxFit.fill)),
  43.                 Container(
  44.                   height: UIHelper.Space100,
  45.                   decoration: BoxDecoration(
  46.                     color: UIHelper.SETTINGS_CARD_BACKGROUND_COLOR,
  47.                     borderRadius: BorderRadius.vertical(
  48.                       bottom: Radius.circular(UIHelper.Space10),
  49.                       top: Radius.circular(UIHelper.Space10),
  50.                     ),
  51.                   ),
  52.                   child: ListTile(
  53.                     title: Text(tips.title),
  54.                     subtitle: Text(tips.subTitle, maxLines: 2),
  55.                   ),
  56.                 )
  57.               ],
  58.             ),
  59.           ),
  60.         ),
  61.       );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top