diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..cf312d0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "ins_note", + "cwd": "ins_note", + "request": "launch", + "type": "dart" + }, + { + "name": "ins_note (profile mode)", + "cwd": "ins_note", + "request": "launch", + "type": "dart", + "flutterMode": "profile" + }, + { + "name": "ins_note (release mode)", + "cwd": "ins_note", + "request": "launch", + "type": "dart", + "flutterMode": "release" + } + ] +} \ No newline at end of file diff --git a/ins_note/lib/feed.dart b/ins_note/lib/feed.dart new file mode 100644 index 0000000..4f19dc8 --- /dev/null +++ b/ins_note/lib/feed.dart @@ -0,0 +1,9 @@ + +class Feed { + final String title; + final String content; + final String location; + // final String icon_location = "/image/location.png"; + + Feed(this.title, this.content, this.location); +} \ No newline at end of file diff --git a/ins_note/lib/feed_page.dart b/ins_note/lib/feed_page.dart new file mode 100644 index 0000000..75cf936 --- /dev/null +++ b/ins_note/lib/feed_page.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import '/feed.dart'; + +class FeedPage extends StatefulWidget { + const FeedPage({Key? key}) : super(key: key); + + @override + State createState() => _FeedPageState(); +} + +class _FeedPageState extends State { + + static List feedTitle = [ + '영감일기', + '김치 장사', + '일기 앱', + '취미 앱', + '번뜩이는 감각', + '구린 음악으로', + '더부룩한 체기를' + ]; + + static List feedContent = [ + '홀홀홀', + '이건 대박이다', + '꼭 만들어야지', + '취미 공유 앱', + '돈 되는 장사', + '더부룩한 체기를', + '탄산 right' + ]; + + static List feedLocation = [ + 'images/location.png', + 'images/location.png', + 'images/location.png', + 'images/location.png', + 'images/location.png', + 'images/location.png', + 'images/location.png', + ]; + + final List feedData = List.generate(feedLocation.length, (index) => + Feed(feedTitle[index], feedContent[index], feedLocation[index])); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: ListView.builder( + itemCount: feedData.length, + itemBuilder: (context, index) { + return Card( + child: ListTile( + title: Text( + feedData[index].title + ), + subtitle: Text( + feedData[index].content + ), + // leading: SizedBox( + // height: 50, + // width: 50, + // child: Image.asset(feedData[index].location) + // ), + ), + ); + } + ) + ); + } + + // _getListData() { + // List widgets = []; + // for (int i = 0; i < 100; i++) { + // widgets.add(GestureDetector( + // child: Padding( + // padding: EdgeInsets.all(10.0), + // child: Text("Row $i") + // ), + // onTap: () { + // // print("row $i tapped"); + // } + // )); + // } + // return widgets; + // } +} \ No newline at end of file diff --git a/ins_note/lib/main.dart b/ins_note/lib/main.dart index 5b2c514..0217991 100644 --- a/ins_note/lib/main.dart +++ b/ins_note/lib/main.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:bottom_bar_with_sheet/bottom_bar_with_sheet.dart'; +import 'my_page.dart'; +import 'feed_page.dart'; -void main() => runApp(const BaseExample()); +void main() => runApp(const MyApp()); -class BaseExample extends StatelessWidget { - const BaseExample({Key? key}) : super(key: key); +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -40,6 +42,19 @@ class _MyHomePageState extends State{ super.initState(); } + int _selectedIndex = 0; + + final List _widgetOptions = [ + FeedPage(), + MyPage(), + ]; + + void _onItemTapped(int index) { + setState(() { + _selectedIndex = index; + }); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -66,20 +81,8 @@ class _MyHomePageState extends State{ ], ), ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Text( - "Place for your content", - style: TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w900, - ), - ), - ], - ), + body: SafeArea( + child: _widgetOptions.elementAt(_selectedIndex), ), bottomNavigationBar: BottomBarWithSheet( controller: _bottomBarController, @@ -99,7 +102,7 @@ class _MyHomePageState extends State{ fontSize: 10.0, ), ), - onSelectItem: (index) => debugPrint('$index'), + onSelectItem: (index) => _onItemTapped(index), sheetChild: Column( children: [ Padding( @@ -162,8 +165,6 @@ class _MyHomePageState extends State{ ), items: const [ BottomBarWithSheetItem(icon: Icons.people), - //BottomBarWithSheetItem(icon: Icons.shopping_cart), - //BottomBarWithSheetItem(icon: Icons.settings), BottomBarWithSheetItem(icon: Icons.favorite), ], ), diff --git a/ins_note/lib/my_page.dart b/ins_note/lib/my_page.dart new file mode 100644 index 0000000..98d1be1 --- /dev/null +++ b/ins_note/lib/my_page.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +class MyPage extends StatelessWidget { + const MyPage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Column( + children: [ + Text('MyPage'), + Text('MyPage'), + Text('MyPage') + ] + ) + ) + ); + } +} \ No newline at end of file