Added search bar

This commit is contained in:
2020-10-11 13:20:19 +02:00
parent f120884d88
commit 4dfd1c5e4a
2 changed files with 51 additions and 10 deletions

View File

@@ -58,3 +58,51 @@ class RestaurantCard extends StatelessWidget {
); );
} }
} }
class MenuiSearchBar extends StatefulWidget {
@override
MenuiSearchBarState createState() {
return MenuiSearchBarState();
}
}
class MenuiSearchBarState extends State<MenuiSearchBar> {
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(12),
child: TextFormField(
style: TextStyle(color: Colors.orange),
decoration: InputDecoration(
hintStyle: TextStyle(color: Colors.grey),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(12)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.orange, width: 2.0),
borderRadius: BorderRadius.circular(12)),
hintText: 'Wyszukaj miasto lub nazwę restauracji.',
suffixIcon: Icon(
Icons.search,
color: Colors.orange,
)),
validator: (value) {
if (value.isEmpty) {
return 'Wpisz coś w pole wyszukiwania.';
}
return null;
},
cursorColor: Colors.orange,
),
),
],
),
);
}
}

View File

@@ -12,6 +12,8 @@ class App extends StatelessWidget {
title: 'Menui', title: 'Menui',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.orange, primarySwatch: Colors.orange,
primaryColor: Colors.orange,
accentColor: Colors.grey,
backgroundColor: Colors.grey, backgroundColor: Colors.grey,
visualDensity: VisualDensity.adaptivePlatformDensity, visualDensity: VisualDensity.adaptivePlatformDensity,
), ),
@@ -44,16 +46,7 @@ class _HomePageState extends State<HomePage> {
"img/logo_mint.png", "img/logo_mint.png",
width: 160, width: 160,
), ),
RestaurantCard( MenuiSearchBar()
id: 1,
name: "Pierożek",
city: "Mikołajki",
),
RestaurantCard(
id: 2,
name: "Kuchnie Świata",
city: "Mikołajki",
)
], ],
), ),
), ),