Skip to content

Commit 1f4bcf0

Browse files
committed
[#5] feat : 친구 목록 UI 구현
1 parent 7ae57e2 commit 1f4bcf0

File tree

4 files changed

+108
-11
lines changed

4 files changed

+108
-11
lines changed

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (flutterVersionName == null) {
2424

2525
android {
2626
namespace "com.example.skhuthon_app"
27-
compileSdkVersion flutter.compileSdkVersion
27+
compileSdkVersion 34
2828
ndkVersion flutter.ndkVersion
2929

3030
compileOptions {
@@ -45,7 +45,7 @@ android {
4545
applicationId "com.example.skhuthon_app"
4646
// You can update the following values to match your application needs.
4747
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
48-
minSdkVersion flutter.minSdkVersion
48+
minSdkVersion 21
4949
targetSdkVersion flutter.targetSdkVersion
5050
versionCode flutterVersionCode.toInteger()
5151
versionName flutterVersionName

lib/app_router.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import 'dart:js';
21

32
import 'package:flutter/material.dart';
43
import 'package:hooks_riverpod/hooks_riverpod.dart';
54
import 'package:go_router/go_router.dart';
5+
import 'package:skhuthon_app/screens/friends/friendsList_screen.dart';
6+
import 'package:skhuthon_app/screens/home/home_screen.dart';
67
import 'package:skhuthon_app/screens/post/createPost_screen.dart';
78

89
import 'screens/Login/login_screen.dart';
@@ -16,24 +17,26 @@ final routerProvider = Provider<GoRouter>((ref) {
1617
return GoRouter(
1718
navigatorKey: _key,
1819
debugLogDiagnostics: true,
19-
initialLocation: '/',
20+
initialLocation: '/friendsList',
2021
refreshListenable: authState,
2122

2223
routes: [
2324
GoRoute(
2425
path: '/',
2526
name: 'home',
26-
builder: (context, state) => const HomeScreen(),
27+
builder: (context, state) => const HomeScreen()
28+
// builder: (context, state) => const HomeScreen(),
2729
),
2830
GoRoute(
2931
path: '/login',
3032
name: 'login',
3133
builder: (context, state) => const LoginScreen(),
3234
),
35+
3336
GoRoute(
34-
path: '/createPost',
35-
name:'createPost',
36-
builder: (context, state) => const CreatePostScreen()
37+
path: '/friendsList',
38+
name: 'friendsList',
39+
builder: (context, state) => const FriendsList_Screen()
3740
)
3841
],
3942

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:skhuthon_app/common/widgets/tabBarBase.dart';
4+
5+
import '../../common/color.dart';
6+
import '../../models/user.dart';
7+
8+
class FriendsList_Screen extends StatefulWidget {
9+
const FriendsList_Screen({super.key});
10+
11+
@override
12+
State<FriendsList_Screen> createState() => _FriendsList_ScreenState();
13+
}
14+
15+
class _FriendsList_ScreenState extends State<FriendsList_Screen> {
16+
User user = User(name: 'a', email: 'd', followingList: ['user1', 'user2', 'user3']);
17+
18+
@override
19+
Widget build(BuildContext context) {
20+
final size = MediaQuery.of(context).size;
21+
22+
return Scaffold(
23+
appBar: AppBar(
24+
title: const Text('Friends'),
25+
),
26+
body: Center(
27+
child: Column(
28+
children: [
29+
const Text('MyPost')
30+
// sharedReperance를 통해 받아온 것들 구현
31+
,
32+
const Text('Following List'),
33+
FutureBuilder<List<String>?>(
34+
future: Future.delayed(const Duration(seconds: 1), () => user.followingList),
35+
builder: (BuildContext context, AsyncSnapshot<List<String>?> snapshot) {
36+
if (snapshot.hasData) {
37+
return ListView.separated(
38+
itemBuilder: (context, index) {
39+
return ListTile(
40+
title: Text('Username: ${snapshot.data![index]}',
41+
style: const TextStyle(fontSize: 20)),
42+
);
43+
},
44+
separatorBuilder: (context, index) {
45+
return const Divider();
46+
},
47+
itemCount: snapshot.data!.length,
48+
);
49+
} else if (snapshot.hasError) {
50+
return const Text('Error loading following list');
51+
} else {
52+
return const Center(child: CircularProgressIndicator());
53+
}
54+
},
55+
),
56+
Padding(padding: EdgeInsets.all(330)),
57+
ElevatedButton(
58+
onPressed: () async {
59+
},
60+
style: ElevatedButton.styleFrom(
61+
padding: EdgeInsets.symmetric(
62+
horizontal: size.width * 0.2,
63+
vertical: size.width * 0.03,
64+
),
65+
backgroundColor: BASE,
66+
shape: RoundedRectangleBorder(
67+
borderRadius: BorderRadius.circular(20),
68+
),
69+
elevation: 0,
70+
),
71+
child: const Row(
72+
mainAxisSize: MainAxisSize.min,
73+
children: [
74+
Icon(Icons.person_add, color: Colors.white,),
75+
SizedBox(width: 8),
76+
Padding(padding: EdgeInsets.all(5)),
77+
Text(
78+
'Add Friends',
79+
style: TextStyle(
80+
color: BLACK,
81+
fontSize: 20,
82+
fontFamily: 'Ink Free',
83+
fontWeight: FontWeight.w400,
84+
),
85+
),
86+
],
87+
),
88+
),
89+
],
90+
),
91+
),
92+
bottomNavigationBar: const TabBarBase(),
93+
);
94+
}
95+
}

lib/screens/post/createPost_screen.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
44
import '../../common/widgets/TextFieldWidget.dart';
55
import '../../common/widgets/tabBarBase.dart';
66

7-
8-
final createPostScreenProvider = ChangeNotifierProvider((ref) => CreatePostScreenProvider());
7+
/*final createPostScreenProvider = ChangeNotifierProvider((ref) => CreatePostScreenProvider());
98
109
class CreatePostScreenProvider extends ChangeNotifier {
1110
final _formKey = GlobalKey<FormState>();
@@ -56,4 +55,4 @@ class CreatePostScreen extends ConsumerWidget {
5655
bottomNavigationBar: const TabBarBase(),
5756
);
5857
}
59-
}
58+
}*/

0 commit comments

Comments
 (0)