-
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/#4 create post
- Loading branch information
Showing
5 changed files
with
176 additions
and
57 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class CustomTextArea extends StatelessWidget { | ||
final String hint; | ||
final funvalidator; | ||
|
||
const CustomTextArea( | ||
{super.key, required this.hint, required this.funvalidator}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 5.0), | ||
child: TextFormField( | ||
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), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |