Página home com os links do menu já funcionais
import 'package:flutter/material.dart';
import 'package:panucci_ristorante/components/main_drawer.dart';
import 'package:panucci_ristorante/screens/bebidas_page.dart';
import 'package:panucci_ristorante/screens/hightlight.dart';
import 'package:panucci_ristorante/screens/menu_page.dart';
import 'package:panucci_ristorante/themes/app_colors.dart';
class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
int _currentPage = 0;
List pages = const [Hightlight(), MenuPage(), BebidasPage()];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Ristorante Panucci"),
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHighest,
actions: const <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Icon(
Icons.account_circle,
size: 32,
),
)
],
centerTitle: true,
),
floatingActionButton: FloatingActionButton(
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) {
return const Home();
}));
},
child: const Icon(Icons.point_of_sale),
),
drawer: const MainDrawer(),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.star_rounded),
label: 'Destaques',
),
BottomNavigationBarItem(
icon: Icon(Icons.restaurant_menu),
label: 'Menu',
),
BottomNavigationBarItem(
icon: Icon(Icons.local_bar),
label: 'Bebidas',
),
],
selectedItemColor: AppColors.bottomNavigationBarIconColor,
currentIndex: _currentPage,
onTap: (index) {
setState(() {
_currentPage = index;
});
},
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: pages[_currentPage],
),
);
}
}
Página do menu
import 'package:flutter/material.dart';
import 'package:panucci_ristorante/cardapio.dart';
import 'package:panucci_ristorante/components/food_item.dart';
class MenuPage extends StatelessWidget {
const MenuPage({super.key});
final List items = comidas;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0),
child: CustomScrollView(
slivers: <Widget>[
const SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.only(bottom: 16),
child: Text(
'Menu',
style: TextStyle(
fontFamily: "Caveat",
fontSize: 32,
),
textAlign: TextAlign.center,
),
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
return FoodItem(
imageURI: items[index]['image'],
itemTitle: items[index]['name'],
itemPrice: items[index]['price'],
);
},
childCount: items.length,
),
)
],
),
);
}
}