|
@@ -12,6 +12,10 @@ import 'package:widgets/my_appbar.dart';
|
|
import 'package:widgets/my_button.dart';
|
|
import 'package:widgets/my_button.dart';
|
|
import 'package:widgets/my_text_field.dart';
|
|
import 'package:widgets/my_text_field.dart';
|
|
import 'package:widgets/widget_export.dart';
|
|
import 'package:widgets/widget_export.dart';
|
|
|
|
+import 'package:widgets/shatter/picker_container.dart';
|
|
|
|
+import 'package:widgets/shatter/form_require_text.dart';
|
|
|
|
+import 'package:widgets/ext/ex_widget.dart';
|
|
|
|
+
|
|
|
|
|
|
import 'garagesale_post_vm.dart';
|
|
import 'garagesale_post_vm.dart';
|
|
|
|
|
|
@@ -35,7 +39,7 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
return Scaffold(
|
|
return Scaffold(
|
|
appBar: MyAppBar.appBar(
|
|
appBar: MyAppBar.appBar(
|
|
context,
|
|
context,
|
|
- "Create Post",
|
|
|
|
|
|
+ "Garagesale Post",
|
|
backgroundColor: context.appColors.whiteBG,
|
|
backgroundColor: context.appColors.whiteBG,
|
|
),
|
|
),
|
|
backgroundColor: Colors.white,
|
|
backgroundColor: Colors.white,
|
|
@@ -48,17 +52,52 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
clipBehavior: Clip.none,
|
|
clipBehavior: Clip.none,
|
|
child: Column(
|
|
child: Column(
|
|
children: [
|
|
children: [
|
|
- // mind textearea
|
|
|
|
|
|
+ // sale 选择
|
|
|
|
+ Container(
|
|
|
|
+ margin: const EdgeInsets.only(left:15, right:15, top: 5),
|
|
|
|
+ child: _buildSaleInputSelectCmp(context, ref),
|
|
|
|
+ ),
|
|
|
|
+ // category 选择
|
|
|
|
+ Container(
|
|
|
|
+ margin: const EdgeInsets.only(left:15, right:15, top: 5),
|
|
|
|
+ child: _buildCategoryInputSelectCmp(context, ref),
|
|
|
|
+ ),
|
|
|
|
+ // title
|
|
|
|
+ Container(
|
|
|
|
+ margin: const EdgeInsets.only(left:15, right:15, top: 20),
|
|
|
|
+ child: Column(
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
+ children: [
|
|
|
|
+ FormRequireText(
|
|
|
|
+ text: "Title",
|
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
|
+ fontSize: 17,
|
|
|
|
+ ).marginOnly(bottom: 14.5),
|
|
|
|
+ _buildInputLayout(context, ref, 'title'),
|
|
|
|
+ ]
|
|
|
|
+ )
|
|
|
|
+ ),
|
|
|
|
+ // description
|
|
Container(
|
|
Container(
|
|
margin: const EdgeInsets.only(left:15, right:15,top: 20),
|
|
margin: const EdgeInsets.only(left:15, right:15,top: 20),
|
|
- child: _buildTextArea(context, ref),
|
|
|
|
|
|
+ child: Column(
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
+ children: [
|
|
|
|
+ FormRequireText(
|
|
|
|
+ text: "Description",
|
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
|
+ fontSize: 17,
|
|
|
|
+ ).marginOnly(bottom: 14.5),
|
|
|
|
+ _buildTextArea(context, ref, 'description'),
|
|
|
|
+ ]
|
|
|
|
+ )
|
|
|
|
+
|
|
),
|
|
),
|
|
Container(
|
|
Container(
|
|
width: double.infinity,
|
|
width: double.infinity,
|
|
height: 200,
|
|
height: 200,
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
- margin: const EdgeInsets.only(left:15, right:15, top: 20, bottom: 20),
|
|
|
|
- padding: const EdgeInsets.all(15),
|
|
|
|
|
|
+ margin: const EdgeInsets.only(left:15, right:15, top: 10, bottom: 20),
|
|
// 选择图片上传 控件
|
|
// 选择图片上传 控件
|
|
child: _buildImageSelectCmp(context, ref,vm),
|
|
child: _buildImageSelectCmp(context, ref,vm),
|
|
),
|
|
),
|
|
@@ -81,6 +120,7 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
fontSize: 16,
|
|
fontSize: 16,
|
|
onPressed: (){
|
|
onPressed: (){
|
|
// Navigator.pop(context);
|
|
// Navigator.pop(context);
|
|
|
|
+ vm.submitGaragesalePost();
|
|
},
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
@@ -93,8 +133,7 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
}
|
|
}
|
|
|
|
|
|
/// textarea
|
|
/// textarea
|
|
- Widget _buildTextArea(BuildContext context, WidgetRef ref){
|
|
|
|
-
|
|
|
|
|
|
+ Widget _buildTextArea(BuildContext context, WidgetRef ref, key){
|
|
final state = ref.watch(garagesalePostVmProvider);
|
|
final state = ref.watch(garagesalePostVmProvider);
|
|
final vm = ref.read(garagesalePostVmProvider.notifier);
|
|
final vm = ref.read(garagesalePostVmProvider.notifier);
|
|
|
|
|
|
@@ -103,7 +142,7 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
height: 200,
|
|
height: 200,
|
|
padding: const EdgeInsets.all(15),
|
|
padding: const EdgeInsets.all(15),
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
- color: Colors.white,
|
|
|
|
|
|
+ color: context.appColors.authFiledBG,
|
|
borderRadius: BorderRadius.circular(5),
|
|
borderRadius: BorderRadius.circular(5),
|
|
// boxShadow: [
|
|
// boxShadow: [
|
|
// BoxShadow(
|
|
// BoxShadow(
|
|
@@ -117,7 +156,7 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
child: _buildTextAreaLayout(
|
|
child: _buildTextAreaLayout(
|
|
context,
|
|
context,
|
|
ref,
|
|
ref,
|
|
- 'mind',
|
|
|
|
|
|
+ key,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -193,11 +232,34 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// sale 选择
|
|
|
|
+ Widget _buildSaleInputSelectCmp(BuildContext context, WidgetRef ref, ){
|
|
|
|
+ final vm = ref.read(garagesalePostVmProvider.notifier);
|
|
|
|
+ final state = ref.watch(garagesalePostVmProvider);
|
|
|
|
+ return PickerContainer(
|
|
|
|
+ content: state.saleSelectedOption ?? "",
|
|
|
|
+ hint: S.current.choose_category,
|
|
|
|
+ margin: const EdgeInsets.only(top: 16),
|
|
|
|
+ onClick: vm.pickSaleCallback,
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// category 选择
|
|
|
|
+ Widget _buildCategoryInputSelectCmp(BuildContext context, WidgetRef ref, ){
|
|
|
|
+ final vm = ref.read(garagesalePostVmProvider.notifier);
|
|
|
|
+ final state = ref.watch(garagesalePostVmProvider);
|
|
|
|
+ return PickerContainer(
|
|
|
|
+ content: state.categorySelectedOption ?? "",
|
|
|
|
+ hint: S.current.choose_category,
|
|
|
|
+ margin: const EdgeInsets.only(top: 16),
|
|
|
|
+ onClick: vm.pickCategoryCallback,
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
|
|
/// 单行输入框
|
|
/// 单行输入框
|
|
Widget _buildInputLayout(
|
|
Widget _buildInputLayout(
|
|
BuildContext context,
|
|
BuildContext context,
|
|
- state,
|
|
|
|
|
|
+ WidgetRef ref,
|
|
String key,
|
|
String key,
|
|
{
|
|
{
|
|
double height = 48,
|
|
double height = 48,
|
|
@@ -211,6 +273,7 @@ class GaragesalePostPage extends HookConsumerWidget {
|
|
TextInputAction textInputAction = TextInputAction.done,
|
|
TextInputAction textInputAction = TextInputAction.done,
|
|
Function? onSubmit,
|
|
Function? onSubmit,
|
|
}) {
|
|
}) {
|
|
|
|
+ final state = ref.watch(garagesalePostVmProvider);
|
|
return IgnoreKeyboardDismiss(
|
|
return IgnoreKeyboardDismiss(
|
|
child: MyTextField(
|
|
child: MyTextField(
|
|
key,
|
|
key,
|