-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
5ee150b
commit 28dea84
Showing
18 changed files
with
603 additions
and
134 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,19 +0,0 @@ | ||
{ | ||
"posts": [ | ||
{ | ||
"title": "고도현", | ||
"date": "2022.02.02", | ||
"content": "sfsdfsfwfewffsdfafawf" | ||
}, | ||
{ | ||
"title": "Hello World", | ||
"date": "2022.02.02", | ||
"content": "sfsdfsfwfewffsdfafawf" | ||
}, | ||
{ | ||
"title": "원호 hi", | ||
"date": "2022.02.02", | ||
"content": "sfsdfsfwfewffsdfafawf" | ||
} | ||
] | ||
} | ||
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
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
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,37 @@ | ||
class Post { | ||
Post({ | ||
this.posts, | ||
}); | ||
List<Value>? posts; | ||
|
||
factory Post.fromJson(Map<String, dynamic> json) => Post( | ||
posts: List<Value>.from(json['posts'].map((x) => Value.fromJson(x))), | ||
); | ||
|
||
Map<String, dynamic> toJson() => { | ||
'posts': List<dynamic>.from(posts!.map((x) => x.toJson())), | ||
}; | ||
} | ||
|
||
class Value { | ||
Value({ | ||
this.title, | ||
this.date, | ||
this.content, | ||
}); | ||
String? title; | ||
String? date; | ||
String? content; | ||
|
||
factory Value.fromJson(Map<String, dynamic> json) => Value( | ||
title: json['title'], | ||
date: json['date'], | ||
content: json['content'], | ||
); | ||
|
||
Map<String, dynamic> toJson() => { | ||
'title': title, | ||
'date': date, | ||
'content': content, | ||
}; | ||
} |
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,50 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:secret_diary/widgets/custom_button.dart'; | ||
import 'package:secret_diary/widgets/field_widget.dart'; | ||
|
||
class AddPostPage extends StatelessWidget { | ||
final titleText = TextEditingController(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Stack( | ||
fit: StackFit.expand, | ||
children: [ | ||
Image.asset( | ||
'assets/background3.png', | ||
fit: BoxFit.fitHeight, | ||
color: Colors.white38, | ||
colorBlendMode: BlendMode.dstOut, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(15), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
FieldWidget( | ||
labelText: '제목을 입력하세요', | ||
controller: titleText, | ||
), | ||
const SizedBox(height: 20), | ||
FieldWidget( | ||
maxLines: 20, | ||
controller: titleText, | ||
), | ||
const SizedBox(height: 28), | ||
CustomButton( | ||
width: 290, | ||
text: '일기 작성하기', | ||
textSize: 20, | ||
backgroundColor: const Color(0xFFFFA786), | ||
onPressed: () {}, | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
Empty file.
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 |
---|---|---|
@@ -1,40 +1,59 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:secret_diary/models/post_model.dart'; | ||
import 'package:secret_diary/pages/add_post_page.dart'; | ||
import 'package:secret_diary/services/post_api.dart'; | ||
import 'package:secret_diary/widgets/post_list_widget.dart'; | ||
|
||
class HomePage extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: const Color(0xFFFFA786), | ||
title: const Text( | ||
'콩순이의 일기장', | ||
style: TextStyle(color: Colors.black), | ||
), | ||
actions: [ | ||
IconButton( | ||
icon: const Icon( | ||
Icons.add_outlined, | ||
color: Colors.black, | ||
size: 30, | ||
), | ||
onPressed: () {}, | ||
) | ||
], | ||
appBar: AppBar( | ||
backgroundColor: const Color(0xFFFFA786), | ||
elevation: 0.0, | ||
title: const Text( | ||
'콩순이의 일기장', | ||
style: TextStyle(color: Colors.black), | ||
), | ||
body: Stack( | ||
fit: StackFit.expand, | ||
children: [ | ||
Image.asset( | ||
'assets/background3.png', | ||
fit: BoxFit.fitHeight, | ||
color: Colors.white38, | ||
colorBlendMode: BlendMode.dstOut, | ||
), | ||
Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [], | ||
actions: [ | ||
IconButton( | ||
icon: const Icon( | ||
Icons.add_outlined, | ||
color: Colors.black, | ||
size: 30, | ||
), | ||
], | ||
)); | ||
onPressed: () { | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute( | ||
builder: (context) => AddPostPage(), | ||
), | ||
); | ||
}, | ||
) | ||
], | ||
), | ||
body: FutureBuilder<Post>( | ||
future: getPost(), | ||
builder: (context, snapshot) { | ||
if (snapshot.connectionState == ConnectionState.waiting || | ||
snapshot.data == null) { | ||
return const Center(child: CircularProgressIndicator()); | ||
} | ||
return Stack( | ||
fit: StackFit.expand, | ||
children: [ | ||
Image.asset( | ||
'assets/background3.png', | ||
fit: BoxFit.fitHeight, | ||
color: Colors.white38, | ||
colorBlendMode: BlendMode.dstOut, | ||
), | ||
PostListWidget(snapshot: snapshot), | ||
], | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} |
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
Oops, something went wrong.