-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#6 update post
- Loading branch information
Showing
9 changed files
with
239 additions
and
61 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
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,56 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:unibond/util/validator_util.dart'; | ||
import 'package:unibond/widgets/custom_text_form_field.dart'; | ||
import 'package:unibond/widgets/custom_textarea.dart'; | ||
import 'package:unibond/widgets/custon_elevated_button.dart'; | ||
|
||
class UpdateScreen extends StatelessWidget { | ||
final _formKey = GlobalKey<FormState>(); | ||
UpdateScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
centerTitle: true, | ||
title: const Text('게시물 수정'), | ||
leading: IconButton( | ||
icon: const Icon(Icons.arrow_back_ios), | ||
onPressed: () { | ||
Get.back(); | ||
}, | ||
), | ||
), | ||
body: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Form( | ||
key: _formKey, | ||
child: ListView( | ||
children: [ | ||
CustomTextFormField( | ||
hint: "제목", | ||
funvalidator: validateTitle, | ||
value: "하하 이것은 나중에 서버에서 받아올 제목이야.", | ||
), | ||
CustomTextArea( | ||
hint: "내용", | ||
funvalidator: validateContent, | ||
value: "나중에 서버에서 받아올 내용. 나는 배가 고파요. " * 10, | ||
), | ||
CustomElevatedButton( | ||
text: "수정 완료", | ||
screenRoute: () { | ||
if (isValid(_formKey)) { | ||
// TODO: 추후 GetX Obs 기능 사용해서 이전 화면 갱신하기 | ||
Get.back(); | ||
} | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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,48 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:unibond/screens/home_screen.dart'; | ||
import 'package:unibond/util/validator_util.dart'; | ||
import 'package:unibond/widgets/custom_text_form_field.dart'; | ||
import 'package:unibond/widgets/custom_textarea.dart'; | ||
import 'package:unibond/widgets/custon_elevated_button.dart'; | ||
|
||
class WriteScreen extends StatelessWidget { | ||
final _formKey = GlobalKey<FormState>(); | ||
WriteScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
centerTitle: true, | ||
title: const Text('게시물 작성'), | ||
leading: IconButton( | ||
icon: const Icon(Icons.arrow_back_ios), | ||
onPressed: () { | ||
Get.back(); | ||
}, | ||
), | ||
), | ||
body: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Form( | ||
key: _formKey, | ||
child: ListView( | ||
children: [ | ||
CustomTextFormField(hint: "제목", funvalidator: validateTitle), | ||
CustomTextArea(hint: "내용", funvalidator: validateContent), | ||
CustomElevatedButton( | ||
text: "작성 완료", | ||
screenRoute: () { | ||
if (isValid(_formKey)) { | ||
Get.off(() => const HomeScreen()); | ||
} | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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
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,38 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class CustomTextArea extends StatelessWidget { | ||
final String hint; | ||
final funvalidator; | ||
final String? value; | ||
|
||
const CustomTextArea( | ||
{super.key, required this.hint, required this.funvalidator, this.value}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 5.0), | ||
child: TextFormField( | ||
initialValue: value ?? "", | ||
maxLines: 14, | ||
validator: funvalidator, | ||
style: const TextStyle(fontSize: 14), | ||
decoration: InputDecoration( | ||
hintText: "$hint을(를) 입력하세요", | ||
enabledBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(20), | ||
), | ||
focusedBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(20), | ||
), | ||
errorBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(20), | ||
), | ||
focusedErrorBorder: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(20), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |