Skip to content

Commit

Permalink
#59 Backend 연결중
Browse files Browse the repository at this point in the history
  • Loading branch information
ZombieBread123 committed May 12, 2024
1 parent 97555db commit 3534ca1
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 48 deletions.
Binary file modified .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions .idea/capstone-2024-39.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion frontend/lib/screens/home/group/group_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ class _GroupState extends State<GroupScreen> {
},
child: Text('${j + 1}'),
),
Text(Thema[j]),
Text(
Thema[j],
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w700,
),
),
],
),
),
Expand Down
58 changes: 11 additions & 47 deletions frontend/lib/screens/home/mypage/mypage_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,6 @@ class MypageScreen extends StatefulWidget {
_MypageScreenState createState() => _MypageScreenState();
}

class Book {
final String title;
final String author;
final String publisher;
final String startDate;
final String endDate;
final String type;
final String imageUrl;

Book({
required this.title,
required this.author,
required this.publisher,
required this.startDate,
required this.endDate,
required this.type,
required this.imageUrl,
});

// factory Book.fromJson(Map<String, dynamic> json) {
// return Book(
// id: json['id'] as int,
// writer: json['writer'] as String,
// clubId: json['clubId'] as int,
// title: json['title'] as String,
// body: json['body'] as String,
// isSticky: json['isSticky'] as bool,
// );
// }
}

class Library {
String name;
List<LibraryBook> books;
Expand All @@ -70,7 +39,7 @@ class _MypageScreenState extends State<MypageScreen>
with SingleTickerProviderStateMixin {
late TabController _tabController;

List<Book> books = [];
var books = [];

List<Library> libraries = [
Library(
Expand Down Expand Up @@ -124,12 +93,12 @@ class _MypageScreenState extends State<MypageScreen>
var id;
var token;
var isLogin;
var userInfo;

@override
void initState() {
super.initState();
_initUserState();
// _initBookState();
_tabController = TabController(length: 2, vsync: this);
books.sort((a, b) => a.endDate.compareTo(b.endDate));
}
Expand All @@ -138,27 +107,18 @@ class _MypageScreenState extends State<MypageScreen>
final secureStorage =
Provider.of<SecureStorageService>(context, listen: false);
token = await secureStorage.readData("token");
id = await secureStorage.readData("id");
print(token);
if (token == null) {
isLogin = false;
} else {
isLogin = true;
userInfo = await getUserInfo(id, token);
books = userInfo['contentList'];
print(books);
}
}

// Future<void> _initBookState() async {
// final secureStorage =
// Provider.of<SecureStorageService>(context, listen: false);
// id = await secureStorage.readData("id");
// token = await secureStorage.readData("token");
// Map<String, dynamic> userInfo = await getUserInfo(id, token);
// if (userInfo.containsKey("contentList")) {
// books = List<Book>.from(userInfo["contentList"].map((bookJson) => Book.fromJson(bookJson)));
// } else {
// books = []; // Handle case when "postList" is not present or is empty
// }
// }

@override
Widget build(BuildContext context) {
return ScreenUtilInit(
Expand Down Expand Up @@ -233,6 +193,10 @@ class LoggedWidget extends StatelessWidget {
children: [
Row(
children: [
Icon(
Icons.account_circle,
size: 70.w,
),
SizedBox(width: 16.w),
Text(
name,
Expand Down Expand Up @@ -316,7 +280,7 @@ void signInWithGoogle(BuildContext context) async {
}

class BookReportWidget extends StatelessWidget {
final List<Book> books;
final List<dynamic> books;

const BookReportWidget({super.key, required this.books});

Expand Down

0 comments on commit 3534ca1

Please sign in to comment.