Skip to content

Commit

Permalink
Add Search Menu and Top Food Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
tarikultopofstack committed Apr 1, 2020
1 parent c15aee3 commit e27b937
Show file tree
Hide file tree
Showing 20 changed files with 182 additions and 111 deletions.
Binary file added assets/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file added assets/images/menus/ic_account.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/menus/ic_cart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/menus/ic_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/menus/ic_near_by.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/menus/ic_search_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/topmenu/ic_burger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/topmenu/ic_cake.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/topmenu/ic_ice_cream.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/topmenu/ic_pasta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/topmenu/ic_pizza.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/topmenu/ic_soft_drink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/topmenu/ic_sushi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 9 additions & 110 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,111 +1,10 @@
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;

void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}

@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Invoke "debug painting" (press "p" in the console, choose the
// "Toggle Debug Paint" action from the Flutter Inspector in Android
// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
// to see the wireframe for each widget.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
import 'package:flutter_app/pages/HomePage.dart';

void main() => runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(fontFamily: 'Roboto',hintColor: Color(0xFFd0cece)),
home: HomePage(),
)
);
44 changes: 44 additions & 0 deletions lib/pages/HomePage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/widgets/SearchWidget.dart';
import 'package:flutter_app/widgets/TopMenus.dart';

class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xFFFAFAFA),
elevation: 0,
title: Text(
"What would you like to eat?",
style: TextStyle(
color: Color(0xFF3a3737),
fontSize: 16,
fontWeight: FontWeight.w500),
),
brightness: Brightness.light,
actions: <Widget>[
IconButton(
icon: Icon(
Icons.notifications_none,
color: Color(0xFF3a3737),
),
onPressed: () {})
],
),
body: Column(
children: <Widget>[
SearchWidget(),
Expanded(
child: TopMenus(),
),
],
),
);
}
}
32 changes: 32 additions & 0 deletions lib/widgets/SearchWidget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';

class SearchWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(left: 10,top: 5,right: 10,bottom: 5),
child: TextField(

decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
borderSide: BorderSide(
width: 0,
color: Color(0xFFfb3132),
style: BorderStyle.none,
),
),
filled: true,
prefixIcon: Icon(
Icons.search,
color: Color(0xFFfb3132),
),
fillColor: Color(0xFFFAFAFA),
suffixIcon: Icon(Icons.sort,color: Color(0xFFfb3132),),
hintStyle: new TextStyle(color: Color(0xFFd0cece), fontSize: 18),
hintText: "What would your like to buy?",
),
),
);
}
}
78 changes: 78 additions & 0 deletions lib/widgets/TopMenus.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import 'package:flutter/material.dart';

class TopMenus extends StatefulWidget {
@override
_TopMenusState createState() => _TopMenusState();
}

class _TopMenusState extends State<TopMenus> {
@override
Widget build(BuildContext context) {
return ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
TopMenuTiles(name: "Burger", imageUrl: "ic_burger", slug: ""),
TopMenuTiles(name: "Sushi", imageUrl: "ic_sushi", slug: ""),
TopMenuTiles(name: "Soft Drink", imageUrl: "ic_soft_drink", slug: ""),
TopMenuTiles(name: "Pizza", imageUrl: "ic_pizza", slug: ""),
TopMenuTiles(name: "Cake", imageUrl: "ic_cake", slug: ""),
TopMenuTiles(name: "Ice Cream", imageUrl: "ic_ice_cream", slug: ""),
],
);
}
}

class TopMenuTiles extends StatelessWidget {
String name;
String imageUrl;
String slug;

TopMenuTiles(
{Key key,
@required this.name,
@required this.imageUrl,
@required this.slug})
: super(key: key);

@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {},
child: Column(
children: <Widget>[
Container(
padding:
EdgeInsets.only(left: 10, right: 5, top: 5, bottom: 5),
/*decoration: new BoxDecoration(boxShadow: [
new BoxShadow(
color: Color(0xFFfae3e2),
blurRadius: 25.0,
offset: Offset(0.0, 0.75),
),
]),*/
child: Card(
color: Colors.white,
elevation: 0.5,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(
Radius.circular(3.0),
),
),
child: Container(
width: 80,
height: 80,

child: Center(
child: Image.asset(
'assets/images/topmenu/' + imageUrl + ".png",
width: 45,
height: 45,
)),
)),
),
Text(name, style: TextStyle(color: Color(0xFF6e6e71), fontSize: 14,fontWeight: FontWeight.normal)),
],
),
);
}
}
20 changes: 19 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,19 @@ flutter:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

assets:
- assets/images/menus/ic_search_menu.png
- assets/images/menus/ic_account.png
- assets/images/menus/ic_cart.png
- assets/images/menus/ic_home.png
- assets/images/menus/ic_near_by.png
- assets/images/topmenu/ic_burger.png
- assets/images/topmenu/ic_cake.png
- assets/images/topmenu/ic_ice_cream.png
- assets/images/topmenu/ic_pasta.png
- assets/images/topmenu/ic_pizza.png
- assets/images/topmenu/ic_sushi.png
- assets/images/topmenu/ic_soft_drink.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

Expand All @@ -70,3 +82,9 @@ flutter:
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
fonts:
- family: Roboto
fonts:
- asset: assets/fonts/Roboto-Regular.ttf
- asset: assets/fonts/Roboto-Bold.ttf
- asset: assets/fonts/Roboto-Light.ttf

0 comments on commit e27b937

Please sign in to comment.