6일차 과제(스타벅스앱화면)

김태원·2023년 4월 1일
0

import 'package:flutter/material.dart';
import 'package:lib/DrinkTile.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: Icon(
Icons.arrow_back_ios,
size: 15,
color: Colors.black,
),
actions: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.search,
color: Colors.black,
),
),
],
),
body: Padding(
padding: EdgeInsets.all(16.0),
child: ListView(
children: [
Text(
'NEW',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
DrinkTile(
title: '골든 미모사 그린 티',
subtitle: 'Golden Mimosa Green Tea',
price: 6100,
imgUrl: 'assets/images/item_drink1.jpeg'),
DrinkTile(
title: '블랙 햅쌀 고봉 라떼',
subtitle: 'Black Rice Latte',
price: 6300,
imgUrl: 'assets/images/item_drink2.jpeg'),
DrinkTile(
title: '아이스 블랙 햅쌀 고봉 라떼',
subtitle: 'Iced Black Rice Latte',
price: 6300,
imgUrl: 'assets/images/item_drink3.jpeg'),
DrinkTile(
title: '스타벅스 튜메릭 라떼',
subtitle: 'Starbucks Turmeric Latte',
price: 6100,
imgUrl: 'assets/images/item_drink4.jpeg'),
DrinkTile(
title: '아이스 스타벅스 튜메릭 라떼',
subtitle: 'Iced Starbucks Turmeric Latte',
price: 6100,
imgUrl: 'assets/images/item_drink5.jpeg'),
],
),
),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: 2,
fixedColor: Colors.green,
items: [
BottomNavigationBarItem(icon: Icon(Icons.home), label: '홈'),
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')
]),
bottomSheet: Container(
height: 64,
color: Colors.black,
child: Padding(
padding: const EdgeInsets.all(15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
style: TextStyle(color: Colors.white),
'주문할 매장을 선택해 주세요.'),
Icon(color: Colors.white, Icons.expand_more)
],
),
)),
),
);
}
}


import 'package:flutter/material.dart';

class DrinkTile extends StatelessWidget {
const DrinkTile({
super.key,
required this.title,
required this.subtitle,
required this.price,
required this.imgUrl,
});

final String title;
final String subtitle;
final int price;
final String imgUrl;

@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(bottom: 8),
child: Row(
children: [
CircleAvatar(
backgroundImage: AssetImage(imgUrl),
radius: 48,
),
SizedBox(
width: 15,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
subtitle,
style:
TextStyle(fontWeight: FontWeight.w200, color: Colors.grey),
),
SizedBox(
height: 10,
),
Text(
'$price원',
style: TextStyle(fontWeight: FontWeight.bold),
)
],
)
],
),
);
}
}

profile
개발자 입니다

0개의 댓글