-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
343 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
lib/01_kakao_t/presentation/main/components/promotion_card_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '내 정보', | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | ||
], | ||
); | ||
}), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('내정보'), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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('서비스'), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters