Skip to content

Commit

Permalink
feat: 카카오 T 디자인 완성
Browse files Browse the repository at this point in the history
  • Loading branch information
junsuk5 committed Apr 4, 2024
1 parent f3bbcb9 commit 60f3b6d
Show file tree
Hide file tree
Showing 15 changed files with 343 additions and 3 deletions.
Binary file added assets/bike.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/black.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/carpool.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/daeli.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/navi.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/park.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/taxi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions lib/01_kakao_t/data/model/promotion.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'promotion.freezed.dart';

@freezed
class Promotion with _$Promotion {
const factory Promotion({
required String title,
required String subtitle,
required String imageUrl,
required Color color,
}) = _Promotion;
}
23 changes: 23 additions & 0 deletions lib/01_kakao_t/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:learn_flutter_together/01_kakao_t/presentation/main/main_screen.dart';

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

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

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MainScreen(),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:learn_flutter_together/01_kakao_t/data/model/promotion.dart';

class PromotionCardWidget extends StatelessWidget {
final Promotion promotion;

const PromotionCardWidget({
super.key,
required this.promotion,
});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: promotion.color,
borderRadius: BorderRadius.circular(20), // 코너를 둥글게 하는 부분입니다.
),
child: Row(
children: [
Column(
children: [
Text(
promotion.title,
style: const TextStyle(
color: Colors.blue,
fontSize: 40,
fontWeight: FontWeight.bold,
),
),
Text(
promotion.subtitle,
style: const TextStyle(
color: Colors.lightBlue,
fontSize: 20,
),
),
],
),
const Spacer(),
ClipRRect(
borderRadius: BorderRadius.circular(50),
child: Image.network(
promotion.imageUrl,
width: 100,
height: 100,
fit: BoxFit.cover,
),
),
],
),
),
);
}
}
54 changes: 54 additions & 0 deletions lib/01_kakao_t/presentation/main/main_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:learn_flutter_together/01_kakao_t/presentation/main/tabs/home_tab.dart';
import 'package:learn_flutter_together/01_kakao_t/presentation/main/tabs/profile_tab.dart';
import 'package:learn_flutter_together/01_kakao_t/presentation/main/tabs/service_tab.dart';

class MainScreen extends StatefulWidget {
const MainScreen({super.key});

@override
State<MainScreen> createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen> {
final List<Widget> _tabs = [
HomeTab(),
const ServiceTab(),
const ProfileTab(),
];

int _selectedIndex = 0;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Takao T'),
elevation: 4,
),
body: _tabs[_selectedIndex],
bottomNavigationBar: BottomNavigationBar(
onTap: (index) {
setState(() {
_selectedIndex = index;
});
},
currentIndex: _selectedIndex,
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: '홈',
),
BottomNavigationBarItem(
icon: Icon(Icons.assignment),
label: '이용서비스',
),
BottomNavigationBarItem(
icon: Icon(Icons.account_box),
label: '내 정보',
),
],
),
);
}
}
168 changes: 168 additions & 0 deletions lib/01_kakao_t/presentation/main/tabs/home_tab.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:learn_flutter_together/01_kakao_t/presentation/main/components/promotion_card_widget.dart';

import '../../../data/model/promotion.dart';

class HomeTab extends StatelessWidget {
final List<Promotion> _promotions = [
const Promotion(
title: '아이유',
subtitle: '아이가 아니에요',
imageUrl:
'https://i.namu.wiki/i/BN1Z3IbM4VoVibKa-QU_sVlmYeBGddpnfQHOlW1InGTFxPLuQqZ397HpsPvgI4ZS-nlvOFGVjOF9z6g3RVn1_A.webp',
color: Colors.yellow,
),
const Promotion(
title: '아이유',
subtitle: '아이가 아니에요',
imageUrl:
'https://i.namu.wiki/i/BN1Z3IbM4VoVibKa-QU_sVlmYeBGddpnfQHOlW1InGTFxPLuQqZ397HpsPvgI4ZS-nlvOFGVjOF9z6g3RVn1_A.webp',
color: Colors.yellow,
),
const Promotion(
title: '아이유',
subtitle: '아이가 아니에요',
imageUrl:
'https://i.namu.wiki/i/BN1Z3IbM4VoVibKa-QU_sVlmYeBGddpnfQHOlW1InGTFxPLuQqZ397HpsPvgI4ZS-nlvOFGVjOF9z6g3RVn1_A.webp',
color: Colors.yellow,
),
];

HomeTab({super.key});

@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: [
_menuSection(),
_promotionSection(),
_noticeSection(),
],
),
);
}

Widget _menuSection() {
return Column(
children: [
Row(
children: [
Expanded(
child: Column(
children: [
Image.asset(
'assets/bike.png',
),
const Text('바이크'),
],
),
),
Expanded(
child: Column(
children: [
Image.asset(
'assets/bike.png',
),
const Text('바이크'),
],
),
),
Expanded(
child: Column(
children: [
Image.asset(
'assets/bike.png',
),
const Text('바이크'),
],
),
),
Expanded(
child: Column(
children: [
Image.asset(
'assets/bike.png',
),
const Text('바이크'),
],
),
),
],
),
Row(
children: [
Expanded(
child: Column(
children: [
Image.asset(
'assets/bike.png',
),
const Text('바이크'),
],
),
),
Expanded(
child: Column(
children: [
Image.asset(
'assets/bike.png',
),
const Text('바이크'),
],
),
),
Expanded(
child: Column(
children: [
Image.asset(
'assets/bike.png',
),
const Text('바이크'),
],
),
),
const Expanded(
child: Spacer(),
),
],
),
],
);
}

Widget _promotionSection() {
return SizedBox(
width: double.infinity,
height: 200,
child: PageView(
children: [
PromotionCardWidget(
promotion: _promotions[0],
),
PromotionCardWidget(
promotion: _promotions[0],
),
PromotionCardWidget(
promotion: _promotions[0],
),
],
),
);
}

Widget _noticeSection() {
return Column(
children: List.generate(20, (index) {
return Row(
children: [
const Icon(Icons.alarm),
Text('공지공지$index'),
],
);
}),
);
}
}
12 changes: 12 additions & 0 deletions lib/01_kakao_t/presentation/main/tabs/profile_tab.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
return const Center(
child: Text('내정보'),
);
}
}
12 changes: 12 additions & 0 deletions lib/01_kakao_t/presentation/main/tabs/service_tab.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
return const Center(
child: Text('서비스'),
);
}
}
5 changes: 2 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ flutter:
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- assets/

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
Expand Down

0 comments on commit 60f3b6d

Please sign in to comment.