Open name27 opened 1 year ago
// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); static const String _title = 'Flutter Code Sample'; @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, //debug 배너 제거 home: Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, foregroundColor: Colors.black, elevation: 0, leading: Icon(Icons.arrow_back), actions: [ Icon(Icons.search), ], ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.all(8.0), child: Text( 'New', style: TextStyle( fontSize: 35, fontWeight: FontWeight.bold, ), ), ), Expanded(child: _buildList()), ], ), floatingActionButton: FloatingActionButton.extended( onPressed: () {}, backgroundColor: Colors.black, shape: BeveledRectangleBorder(borderRadius: BorderRadius.zero), label: SizedBox( width: 330, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('주문할 매장을 선택해주세요.'), Icon(Icons.keyboard_arrow_down), ], ), ), ), bottomNavigationBar: BottomNavigationBar( type: BottomNavigationBarType.fixed, selectedItemColor: Colors.green, items: [ BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), BottomNavigationBarItem(icon: Icon(Icons.payment), label: 'Pay'), BottomNavigationBarItem(icon: Icon(Icons.coffee), label: 'Order'), BottomNavigationBarItem(icon: Icon(Icons.shop), label: 'Shop'), BottomNavigationBarItem( icon: Icon(Icons.more_horiz), label: 'Other'), ], ), ), ); } } Widget _buildList() => ListView( children: [ DrinkTile('골든 미모사 그린 티', 'Golden Mimosa Green Tea', '6100원', 'assets/images/item_drink1.jpeg'), DrinkTile('블랙 햅쌀 고봉 라떼', 'Black Rice Latte', '6300원', 'assets/images/item_drink2.jpeg'), DrinkTile('아이스 블랙 햅쌀 고봉 라떼', 'Iced Black Rice Latte', '6300원', 'assets/images/item_drink3.jpeg'), DrinkTile('스타벅스 튜메릭 라떼', 'Starbucks Turmeric Latte', '6100원', 'assets/images/item_drink4.jpeg'), DrinkTile('아이스 스타벅스 튜메릭 라떼', 'Iced Starbucks Turmeric Latte', '6100원', 'assets/images/item_drink5.jpeg'), ], ); ListTile DrinkTile( String title, String subtitle, String price, String backgroundImage) => ListTile( minLeadingWidth: 0.1, title: Text( title, style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, ), ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( subtitle, style: TextStyle( fontSize: 14, fontWeight: FontWeight.w200, ), ), Text( price, style: TextStyle( fontSize: 16, color: Colors.black, fontWeight: FontWeight.bold, ), ), ], ), isThreeLine: true, leading: CircleAvatar( backgroundImage: AssetImage(backgroundImage), radius: 48, ), );