Skip to content

Commit

Permalink
Refine the ui
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkyung1234 committed Jun 1, 2022
1 parent 6de6aee commit 3d99d31
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 48 deletions.
1 change: 1 addition & 0 deletions assets/posts.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "gg",
"posts": [
{
"title": "고도현",
Expand Down
6 changes: 5 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:device_preview/device_preview.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand All @@ -10,7 +11,10 @@ void main() {
providers: [
ChangeNotifierProvider<SignUpHelper>(create: (_) => SignUpHelper()),
],
child: MyApp(),
child: DevicePreview(
enabled: false,
builder: (context) => const MyApp(),
),
),
);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/models/post_model.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
class Post {
Post({
this.name,
this.posts,
});
String? name;
List<Value>? posts;

factory Post.fromJson(Map<String, dynamic> json) => Post(
name: json['name'],
posts: List<Value>.from(json['posts'].map((x) => Value.fromJson(x))),
);

Map<String, dynamic> toJson() => {
'name': name,
'posts': List<dynamic>.from(posts!.map((x) => x.toJson())),
};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/add_post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AddPostPage extends StatelessWidget {
children: [
Image.asset(
'assets/background3.png',
fit: BoxFit.fitHeight,
fit: BoxFit.cover,
color: Colors.white38,
colorBlendMode: BlendMode.dstOut,
),
Expand Down
73 changes: 37 additions & 36 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,54 @@ 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),
elevation: 0.0,
title: const Text(
'콩순이의 일기장',
style: TextStyle(color: Colors.black),
),
actions: [
IconButton(
icon: const Icon(
Icons.add_outlined,
color: Colors.black,
size: 30,
return FutureBuilder<Post>(
future: getPost(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting ||
snapshot.data == null) {
return const Scaffold(
body: Center(child: CircularProgressIndicator()));
}
return Scaffold(
appBar: AppBar(
backgroundColor: const Color(0xFFFFA786),
elevation: 0.0,
title: Text(
snapshot.data!.name!,
style: const TextStyle(color: Colors.black),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddPostPage(),
actions: [
IconButton(
icon: const Icon(
Icons.add_outlined,
color: Colors.black,
size: 30,
),
);
},
)
],
),
body: FutureBuilder<Post>(
future: getPost(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting ||
snapshot.data == null) {
return const Center(child: CircularProgressIndicator());
}
return Stack(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddPostPage(),
),
);
},
)
],
),
body: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/background3.png',
fit: BoxFit.fitHeight,
fit: BoxFit.cover,
color: Colors.white38,
colorBlendMode: BlendMode.dstOut,
),
PostListWidget(snapshot: snapshot),
],
);
},
),
),
);
},
);
}
}
2 changes: 1 addition & 1 deletion lib/pages/login/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LoginPage extends StatelessWidget {
children: [
Image.asset(
'assets/background.png',
fit: BoxFit.fitWidth,
fit: BoxFit.cover,
),
Center(
child: Column(
Expand Down
10 changes: 8 additions & 2 deletions lib/pages/login/signin_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:secret_diary/pages/home_page.dart';
import 'package:secret_diary/pages/test.dart';
import 'package:secret_diary/widgets/custom_button.dart';
import 'package:syncfusion_flutter_signaturepad/signaturepad.dart';

Expand All @@ -11,13 +12,12 @@ class SignInPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey,
body: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/background2.png',
fit: BoxFit.fitHeight,
fit: BoxFit.cover,
color: Colors.grey.withOpacity(0.5),
colorBlendMode: BlendMode.modulate,
),
Expand Down Expand Up @@ -59,6 +59,12 @@ class SignInPage extends StatelessWidget {
// final bytes =
// await data.toByteData(format: ImageByteFormat.png);
// final image = bytes!.buffer.asUint8List();
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => TestPage(image: image),
// ),
// );

Navigator.pop(context);
Navigator.pop(context);
Expand Down
12 changes: 6 additions & 6 deletions lib/pages/login/signup_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
// import 'package:flutter_drawing_board/flutter_drawing_board.dart';
import 'package:provider/provider.dart';
import 'package:secret_diary/providers/signup_provider.dart';
import 'package:secret_diary/widgets/custom_button.dart';
Expand All @@ -19,13 +18,12 @@ class SignupPage extends StatelessWidget {
var provider = Provider.of<SignUpHelper>(context);

return Scaffold(
backgroundColor: Colors.grey,
body: Stack(
fit: StackFit.expand,
children: [
Image.asset(
'assets/background2.png',
fit: BoxFit.fitHeight,
fit: BoxFit.cover,
color: Colors.grey.withOpacity(0.5),
colorBlendMode: BlendMode.modulate,
),
Expand Down Expand Up @@ -58,9 +56,11 @@ class SignupPage extends StatelessWidget {
text: '다음',
backgroundColor: Colors.white,
onPressed: () {
_controller.animateTo(MediaQuery.of(context).size.width,
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn);
_controller.animateTo(
MediaQuery.of(context).size.width,
duration: const Duration(milliseconds: 300),
curve: Curves.ease,
);
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/post_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PostDetailPage extends StatelessWidget {
children: [
Image.asset(
'assets/background3.png',
fit: BoxFit.fitHeight,
fit: BoxFit.cover,
color: Colors.white38,
colorBlendMode: BlendMode.dstOut,
),
Expand Down
21 changes: 21 additions & 0 deletions lib/pages/test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'dart:typed_data';

import 'package:flutter/material.dart';

class TestPage extends StatelessWidget {
final Uint8List image;

const TestPage({Key? key, required this.image}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey,
body: Column(
children: [
Image.memory(image),
],
),
);
}
}
40 changes: 40 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
device_frame:
dependency: transitive
description:
name: device_frame
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
device_preview:
dependency: "direct main"
description:
name: device_preview
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -83,6 +97,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_localizations:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -93,6 +112,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
freezed_annotation:
dependency: transitive
description:
name: freezed_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
http:
dependency: "direct main"
description:
Expand All @@ -107,13 +133,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
lints:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies:
http: ^0.13.4
provider: ^6.0.2
syncfusion_flutter_signaturepad: ^20.1.56
device_preview: ^1.0.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 3d99d31

Please sign in to comment.