diff options
author | mavlonerkinboev <mavlonbek.ibragimov007@gmail.com> | 2021-11-02 19:08:47 +0500 |
---|---|---|
committer | mavlonerkinboev <mavlonbek.ibragimov007@gmail.com> | 2021-11-02 19:08:47 +0500 |
commit | b517bb487e89dd3bfc18a6e04f0419dc5ae5bda5 (patch) | |
tree | 56c6edeb7119d67036c99dc2aaac9b9a5f5bb5c5 | |
parent | 1faa968af1c288d283552cb2293abfc1812f3771 (diff) |
Reformatted code
-rwxr-xr-x | lib/pages/homepage.dart | 165 |
1 files changed, 92 insertions, 73 deletions
diff --git a/lib/pages/homepage.dart b/lib/pages/homepage.dart index 23a4be0..c5398a7 100755 --- a/lib/pages/homepage.dart +++ b/lib/pages/homepage.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:recipes/models/recipe.dart'; class HomePage extends StatelessWidget { + final List<Recipe> _allRecipes = Recipe.allRecipes(); HomePage() {} @@ -35,33 +36,39 @@ class HomePage extends StatelessWidget { Widget _getItemUI(BuildContext context, int index) { return new Card( child: new Column( - children: <Widget>[ - new ListTile( - leading: new Image.asset( - "assets/" + _allRecipes[index].image, - fit: BoxFit.cover, - width: 150.0, - ), - title: new Text( - _allRecipes[index].name, - style: new TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), - ), - subtitle: new Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: <Widget>[ - new Text(_allRecipes[index].desc, - style: new TextStyle(fontSize: 14.0, fontWeight: FontWeight.normal)), - ], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => Information(name: this._allRecipes[index].name, image: this._allRecipes[index].image, description: this._allRecipes[index].description, ingredients: this._allRecipes[index].ingredients, tutorial: this._allRecipes[index].tutorial)) - ); - }, - ), - ], + children: <Widget>[ + new ListTile( + leading: new Image.asset( + "assets/" + _allRecipes[index].image, + fit: BoxFit.cover, + width: 150.0, + ), + title: new Text( + _allRecipes[index].name, + style: new TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), + ), + subtitle: new Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: <Widget>[ + new Text(_allRecipes[index].desc, + style: new TextStyle( + fontSize: 14.0, fontWeight: FontWeight.normal)), + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Information( + name: this._allRecipes[index].name, + image: this._allRecipes[index].image, + description: this._allRecipes[index].description, + ingredients: this._allRecipes[index].ingredients, + tutorial: this._allRecipes[index].tutorial))); + }, + ), + ], )); } } @@ -73,62 +80,74 @@ class Information extends StatelessWidget { final String ingredients; final String tutorial; - Information({Key key, @required this.name, this.image, this.description, this.ingredients, this.tutorial}) : super(key: key); + Information( + {Key key, + @required this.name, + this.image, + this.description, + this.ingredients, + this.tutorial}) + : super(key: key); @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: Text("Описание"), - ), - body: ListView( - children: <Widget>[ - Center( - child: Padding( - padding: EdgeInsets.fromLTRB(0, 10, 0, 10), + appBar: AppBar( + title: Text("Описание"), + ), + body: ListView( + children: <Widget>[ + Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 10, 0, 10), + child: Text( + name, + style: new TextStyle( + fontSize: 24.0, fontWeight: FontWeight.bold), + )), + ), + Padding( + padding: EdgeInsets.fromLTRB(10, 0, 10, 10), child: Text( - name, - style: new TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), + description, + style: new TextStyle( + fontSize: 18.0, fontWeight: FontWeight.normal), )), - ), - Padding( - padding: EdgeInsets.fromLTRB(10, 0, 10, 10), - child: Text( - description, - style: new TextStyle(fontSize: 18.0, fontWeight: FontWeight.normal), - )), - FittedBox( + FittedBox( child: Image.asset( "assets/" + image, fit: BoxFit.cover, width: 1000.0, ), ), - Padding( - padding: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Text( - "Ингредиенты:", - style: new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), - )), - Padding( - padding: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Text( - ingredients, - style: new TextStyle(fontSize: 18.0, fontWeight: FontWeight.normal), - )), - Padding( - padding: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Text( - "Пошаговый рецепт приготовления:", - style: new TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), - )), - Padding( - padding: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Text( - tutorial, - style: new TextStyle(fontSize: 18.0, fontWeight: FontWeight.normal), - )), - ], - ) - ); + Padding( + padding: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Text( + "Ингредиенты:", + style: new TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold), + )), + Padding( + padding: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Text( + ingredients, + style: new TextStyle( + fontSize: 18.0, fontWeight: FontWeight.normal), + )), + Padding( + padding: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Text( + "Пошаговый рецепт приготовления:", + style: new TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold), + )), + Padding( + padding: EdgeInsets.fromLTRB(10, 10, 10, 10), + child: Text( + tutorial, + style: new TextStyle( + fontSize: 18.0, fontWeight: FontWeight.normal), + )), + ], + )); } } |