Skip to content

Commit

Permalink
퍼블리싱 끝
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkyung1234 committed May 16, 2022
1 parent 5ee150b commit 28dea84
Show file tree
Hide file tree
Showing 18 changed files with 603 additions and 134 deletions.
19 changes: 0 additions & 19 deletions assets/posts.json
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"
}
]
}
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
15 changes: 10 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'pages/add_post_page.dart';
import 'pages/login/login_page.dart';
import 'pages/login/signup_page.dart';
import 'providers/signup_provider.dart';

void main() {
runApp(
// MultiProvider(
// providers: [],
// child:
MyApp(),
// ),
MultiProvider(
providers: [
ChangeNotifierProvider<SignUpHelper>(create: (_) => SignUpHelper()),
],
child: MyApp(),
),
);
}

Expand All @@ -21,6 +25,7 @@ class MyApp extends StatelessWidget {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: LoginPage(),
// home: SignupPage(),
);
}
}
37 changes: 37 additions & 0 deletions lib/models/post_model.dart
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,
};
}
50 changes: 50 additions & 0 deletions lib/pages/add_post_page.dart
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 removed lib/pages/diary_detil_page.dart
Empty file.
79 changes: 49 additions & 30 deletions lib/pages/home_page.dart
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),
],
);
},
),
);
}
}
68 changes: 29 additions & 39 deletions lib/pages/login/login_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import 'package:flutter/material.dart';
import 'package:secret_diary/pages/login/signin_page.dart';
import 'package:secret_diary/widgets/custom_button.dart';

import 'signup_page.dart';

class LoginPage extends StatelessWidget {
@override
Expand All @@ -16,47 +19,34 @@ class LoginPage extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
width: 350,
height: 60,
child: RaisedButton(
child: const Text(
'로그인하러 가기',
style: TextStyle(color: Color(0xFFD04861), fontSize: 25),
),
color: const Color(0xFFFEE3D9),
shape: RoundedRectangleBorder(
side:
const BorderSide(color: Color(0xFFEE9E05), width: 6),
borderRadius: BorderRadius.circular(10),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SignInPage(),
),
);
},
),
CustomButton(
text: '로그인하러 가기',
textColor: const Color(0xFFD04861),
borderSide:
const BorderSide(color: Color(0xFFEE9E05), width: 6),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SignInPage(),
),
);
},
),
const SizedBox(height: 30),
Container(
width: 350,
height: 60,
child: RaisedButton(
child: const Text(
'회원가입하러 가기',
style: TextStyle(color: Color(0xFFD04861), fontSize: 25),
),
color: const Color(0xFFFEE3D9),
shape: RoundedRectangleBorder(
side:
const BorderSide(color: Color(0xFFEE9E05), width: 6),
borderRadius: BorderRadius.circular(10),
),
onPressed: () {},
),
CustomButton(
text: '회원가입하러 가기',
textColor: const Color(0xFFD04861),
borderSide:
const BorderSide(color: Color(0xFFEE9E05), width: 6),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SignupPage(),
),
);
},
),
const SizedBox(height: 150),
],
Expand Down
Loading

0 comments on commit 28dea84

Please sign in to comment.