glglove 1 hafta önce
ebeveyn
işleme
9fd93598bc

+ 215 - 5
packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_page.dart

@@ -1,10 +1,19 @@
 import 'package:cpt_community/router/page/community_page_router.dart';
+import 'package:cs_resources/generated/l10n.dart';
 import 'package:cs_resources/theme/app_colors_theme.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:plugin_platform/engine/image/image_nine_grid.dart';
 import 'package:router/ext/auto_router_extensions.dart';
+import 'package:shared/utils/color_utils.dart';
 import 'package:widgets/my_appbar.dart';
+import 'package:widgets/my_button.dart';
+import 'package:widgets/my_text_field.dart';
+import 'package:widgets/widget_export.dart';
+
+import 'garagesale_post_vm.dart';
 
 @RoutePage()
 class GaragesalePostPage extends HookConsumerWidget {
@@ -21,17 +30,218 @@ class GaragesalePostPage extends HookConsumerWidget {
 
   @override
   Widget build(BuildContext context, WidgetRef ref) {
-    // final viewModel = ref.watch(newsfeedPostVmProvider.notifier);
+    final vm = ref.read(garagesalePostVmProvider.notifier);
 
     return Scaffold(
       appBar: MyAppBar.appBar(
         context,
-        "Post New Item",
+        "Create Post",
         backgroundColor: context.appColors.whiteBG,
       ),
-      backgroundColor: context.appColors.backgroundDefault,
-      body: Center(
-        child: Text("GaragesalePost"),
+      backgroundColor: Colors.white,
+      body: Column(
+          children: [
+            Expanded(
+                child: SingleChildScrollView(
+                    scrollDirection: Axis.vertical,
+                    physics: const BouncingScrollPhysics(),
+                    clipBehavior: Clip.none,
+                    child: Column(
+                        children: [
+                          // mind textearea
+                          Container(
+                            margin: const EdgeInsets.only(left:15, right:15,top: 20),
+                            child: _buildTextArea(context, ref),
+                          ),
+                          Container(
+                            width: double.infinity,
+                            height: 200,
+                            color: Colors.white,
+                            margin: const EdgeInsets.only(left:15, right:15, top: 20, bottom: 20),
+                            padding: const EdgeInsets.all(15),
+                            // 选择图片上传 控件
+                            child: _buildImageSelectCmp(context, ref,vm),
+                          ),
+                        ]
+                    )
+                )
+            ),
+            // 底部 按钮
+            Container(
+              child: Row(
+                  children: [
+                    Expanded(
+                      child: MyButton(
+                        text: "Add Card",
+                        radius: 0,
+                        minHeight: 50,
+                        backgroundColor: context.appColors.textPrimary,
+                        textColor: Colors.white,
+                        fontWeight: FontWeight.w500,
+                        fontSize: 16,
+                        onPressed: (){
+                          // Navigator.pop(context);
+                        },
+                      ),
+                    ),
+                  ]
+              ),
+            )
+          ]
+      ),
+    );
+  }
+
+  /// textarea
+  Widget _buildTextArea(BuildContext context, WidgetRef ref){
+
+    final state = ref.watch(garagesalePostVmProvider);
+    final vm = ref.read(garagesalePostVmProvider.notifier);
+
+    return Container(
+      width: double.infinity,
+      height: 200,
+      padding: const EdgeInsets.all(15),
+      decoration: BoxDecoration(
+        color: Colors.white,
+        borderRadius: BorderRadius.circular(5),
+        // boxShadow: [
+        //   BoxShadow(
+        //     color: Colors.grey.withOpacity(0.5),
+        //     spreadRadius: 1,
+        //     blurRadius: 1,
+        //     offset: const Offset(0, 3), // changes position of shadow
+        //   ),
+        // ]
+      ),
+      child: _buildTextAreaLayout(
+        context,
+        ref,
+        'mind',
+      ),
+    );
+  }
+  /// 选择图片上传组件
+  Widget _buildImageSelectCmp(BuildContext context, WidgetRef ref,vm,){
+    final state = ref.watch(garagesalePostVmProvider);
+    return ImageNineGrid(
+      isSelectEnable: true,
+      maxImages: 10,
+      spacing: 10,
+      aspectRatio: 108 / 80,
+      initialImages: state.imgList,
+      onImagesChanged: (list) {
+        vm.setImgList(list);
+      },
+    );
+  }
+
+  /// 多行输入框
+  Widget _buildTextAreaLayout(BuildContext context, ref, key){
+    final state = ref.watch(garagesalePostVmProvider);
+    final vm = ref.read(garagesalePostVmProvider.notifier);
+    final noteCount = useState(0);
+
+    return Stack(
+        children: [
+          TextField(
+            cursorColor: context.appColors.authFiledText,
+            cursorWidth: 1.5,
+            autofocus: false,
+            enabled: true,
+            maxLines: null,
+            focusNode: state.formData[key]!['focusNode'],
+            controller: state.formData[key]!['controller'],
+            decoration: InputDecoration(
+              isDense: true,
+              isCollapsed: true,
+              border: InputBorder.none,
+              hintText: state.formData[key]!['hintText'],
+              hintStyle: TextStyle(
+                color: context.appColors.authFiledHint,
+                fontSize: 16.0,
+                fontWeight: FontWeight.w500,
+              ),
+            ),
+            style: TextStyle(
+              color: context.appColors.authFiledText,
+              fontSize: 16.0,
+              fontWeight: FontWeight.w500,
+            ),
+            textInputAction: TextInputAction.done,
+            onSubmitted: (value) {
+              FocusScope.of(context).unfocus();
+            },
+            expands: true,
+            onChanged: (text) {
+              // 当文本改变时,更新字符数量
+              noteCount.value = text.length;
+            },
+          ),
+          Positioned(
+            bottom: 0.0,
+            right: 0.0,
+            child: Text(
+              S.current.characters(noteCount.value),
+              style: TextStyle(
+                color: context.appColors.textBlack,
+                fontSize: 15.0,
+              ),
+            ),
+          ),
+        ]
+    );
+  }
+
+
+  /// 单行输入框
+  Widget _buildInputLayout(
+      BuildContext context,
+      state,
+      String key,
+      {
+        double height = 48,
+        double maxLines = 1,
+        double marginTop = 0,
+        bool? showRightIcon = false, //是否展示右侧的布局
+        Widget? rightWidget, //右侧的布局
+        TextInputType textInputType = TextInputType.text,
+        String? errorText,
+        bool obscureText = false,
+        TextInputAction textInputAction = TextInputAction.done,
+        Function? onSubmit,
+      }) {
+    return IgnoreKeyboardDismiss(
+      child: MyTextField(
+        key,
+        fillBackgroundColor: context.appColors.authFiledBG,
+        state.formData[key]!['value'],
+        hintText: state.formData[key]!['hintText'],
+        hintStyle: TextStyle(
+          color: context.appColors.authFiledHint,
+          fontSize: 16.0,
+          fontWeight: FontWeight.w500,
+        ),
+        controller: state.formData[key]!['controller'],
+        focusNode: state.formData[key]!['focusNode'],
+        margin: EdgeInsets.only(top: marginTop),
+        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
+        showDivider: false,
+        height: height,
+        style: TextStyle(
+          color: context.appColors.authFiledText,
+          fontSize: 16.0,
+          fontWeight: FontWeight.w500,
+        ),
+        inputType: textInputType,
+        textInputAction: textInputAction,
+        onSubmit: onSubmit,
+        cursorColor: context.appColors.authFiledText,
+        obscureText: obscureText,
+        errorText: errorText,
+        showLeftIcon: true,
+        showRightIcon: showRightIcon,
+        rightWidget: rightWidget,
       ),
     );
   }

+ 84 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_state.dart

@@ -0,0 +1,84 @@
+import 'package:flutter/cupertino.dart';
+
+class GaragesalePostPageState {
+  //表单的错误信息展示
+  String? fieldErrorText;
+  //表单的校验与数据
+  final Map<String, Map<String, dynamic>> formData;
+
+  // 标题
+  final String? title;
+  // 描述
+  final String? description;
+
+  //sale 类型选项
+  final List<String> saleOptionsList = ["SALE1", "SALE2", "SALE3", "SALE4"];
+  String? saleSelectedOption;
+
+  //category 类型选项
+  final List<String> categoryOptionsList = ["Category1", "Category2", "Category3", "Category4"];
+  String? categorySelectedOption;
+
+  // 选择的图片
+  final List<String> imgList;
+
+  GaragesalePostPageState({
+    formData,
+    required this.imgList,
+    this.fieldErrorText,
+    this.title,
+    this.description,
+    this.saleSelectedOption,
+    this.categorySelectedOption,
+  }): formData = formData ?? {
+    'sale': {
+      'value': '',
+      'controller': TextEditingController(),
+      'hintText': '',
+      'focusNode': FocusNode(),
+      'obsecure': false,
+    },
+    'category': {
+      'value': '',
+      'controller': TextEditingController(),
+      'hintText': '',
+      'focusNode': FocusNode(),
+      'obsecure': false,
+    },
+    'title': {
+      'value': '',
+      'controller': TextEditingController(),
+      'hintText': '',
+      'focusNode': FocusNode(),
+      'obsecure': false,
+    },
+    'description': {
+      'value': '',
+      'controller': TextEditingController(),
+      'hintText': '',
+      'focusNode': FocusNode(),
+      'obsecure': false,
+    },
+  };
+
+  GaragesalePostPageState copyWith({
+    Map<String, Map<String, dynamic>>? formData,
+    List<String>? imgList,
+    String? fieldErrorText,
+    String? saleSelectedOption,
+    String? categorySelectedOption,
+    String? title,
+    String? description,
+  }) {
+    return GaragesalePostPageState(
+      formData: formData ?? this.formData,
+      title: title ?? this.title,
+      description: description ?? this.description,
+      imgList: imgList ?? this.imgList,
+      saleSelectedOption: saleSelectedOption ?? this.saleSelectedOption,
+      categorySelectedOption: categorySelectedOption ?? this.categorySelectedOption,
+      fieldErrorText: fieldErrorText ?? this.fieldErrorText,
+    );
+  }
+
+}

+ 196 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_vm.dart

@@ -0,0 +1,196 @@
+
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/material.dart';
+import 'package:plugin_platform/engine/toast/toast_engine.dart';
+import 'package:riverpod_annotation/riverpod_annotation.dart';
+import 'package:router/path/router_path.dart';
+import 'package:shared/utils/color_utils.dart';
+import 'package:shared/utils/log_utils.dart';
+import 'package:auto_route/auto_route.dart';
+import 'package:shared/utils/util.dart';
+import 'package:widgets/picker/option_pick_util.dart';
+
+
+import 'garagesale_post_page.dart';
+import 'garagesale_post_state.dart';
+
+part 'garagesale_post_vm.g.dart';
+
+@riverpod
+class GaragesalePostVm extends _$GaragesalePostVm {
+
+  GaragesalePostPageState initState() {
+    return GaragesalePostPageState(
+      fieldErrorText: '',
+      formData: {
+        'sale': {
+          'value': '',
+          'controller': TextEditingController(),
+          'hintText': '',
+          'focusNode': FocusNode(),
+          'obsecure': false,
+        },
+        'category': {
+          'value': '',
+          'controller': TextEditingController(),
+          'hintText': '',
+          'focusNode': FocusNode(),
+          'obsecure': false,
+        },
+        'title': {
+          'value': '',
+          'controller': TextEditingController(),
+          'hintText': '',
+          'focusNode': FocusNode(),
+          'obsecure': false,
+        },
+        'description': {
+          'value': '',
+          'controller': TextEditingController(),
+          'hintText': '',
+          'focusNode': FocusNode(),
+          'obsecure': false,
+        },
+      },
+      imgList: [],
+    );
+  }
+
+  @override
+  GaragesalePostPageState build() {
+    // 初始化状态
+    GaragesalePostPageState state = initState();
+
+    // 当前渲染完成后执行一次
+    WidgetsBinding.instance!.addPostFrameCallback((_) {
+      // 获取焦点
+      initListener(state);
+      ref.onDispose(() {
+        onDispose(state);
+      });
+    });
+
+    return state;
+  }
+
+  //catogery 选择选项
+  void pickCategory() {
+    _dismissKeyboard(keyStr: 'title');
+    _dismissKeyboard(keyStr: 'description');
+
+    OptionPickerUtil.showCupertinoOptionPicker(
+      items: state.categoryOptionsList,
+      initialSelectIndex: 0,
+      onPickerChanged: (_, index) {
+        state = state.copyWith(categorySelectedOption: state.categoryOptionsList[index]);
+      },
+    );
+  }
+
+  //sale 选择选项
+  void pickSale() {
+    _dismissKeyboard(keyStr: 'title');
+    _dismissKeyboard(keyStr: 'description');
+
+    OptionPickerUtil.showCupertinoOptionPicker(
+      items: state.saleOptionsList,
+      initialSelectIndex: 0,
+      onPickerChanged: (_, index) {
+        state = state.copyWith(saleSelectedOption: state.saleOptionsList[index]);
+      },
+    );
+  }
+
+  // 获取聚焦的node
+  FocusNode getFocusNode(Map<String, dynamic> formData, String keyStr) {
+    return formData![keyStr]!['focusNode'];
+  }
+
+  // 取消表单聚焦状态
+  void _dismissKeyboard({String? keyStr}) {
+    if(keyStr!.isNotEmpty){
+      Log.d("FeedbackCreateViewModel 取消单个表单 $keyStr 聚焦状态");
+      final FocusNode sigleItemFocusNode = state.formData[keyStr]!['focusNode'];
+      sigleItemFocusNode!.unfocus();
+    }else {
+      Log.d("FeedbackCreateViewModel 取消所有表单聚焦状态");
+      // 遍历 formData 的所有表单 然后逐一取消聚焦
+      Map<String, dynamic> formData = state.formData;
+      for(String key in formData.keys){
+        final FocusNode sigleItemFocusNode = formData[key]['focusNode'];
+        sigleItemFocusNode!.unfocus();
+      }
+    }
+  }
+
+  // 获取表单的值
+  dynamic _getFormFieldValue({List<String>? keys, String? keyStr}) {
+    if(keyStr!.isEmpty){
+      if(keys!.isNotEmpty){
+        // 遍历keys获取指定多个 keys 的表单value
+        Map<String, dynamic> resultValueMap = {};
+        for (String itemStr in keys!) {
+          TextEditingController sigleItemController = state.formData[itemStr]!['controller'];
+          resultValueMap[itemStr] = sigleItemController.text;
+        }
+        return resultValueMap;
+      }
+    }else if(keyStr!.isNotEmpty){
+      // 获取单个表单的value
+      final TextEditingController sigleItemController = state.formData[keyStr]!['controller'];
+      return sigleItemController.text;
+    }
+  }
+
+  ///提交反馈
+  void submitGaragesalePost() {
+    state = state.copyWith(fieldErrorText: null);
+
+    _dismissKeyboard();
+
+    // 获取表单的值
+    String mindValue = _getFormFieldValue(keyStr: 'mind');
+
+    Log.d('当前待提交的 mind:$mindValue  imgList:${state.imgList}');
+
+
+    if (Utils.isEmpty(mindValue)) {
+      state = state.copyWith(fieldErrorText: "Title cannot be empty!");
+      return;
+    }
+
+    //去成功页面
+    // FeedbackCreateSuccessPage.startInstance();
+    // 返回上一页
+  }
+
+  //选中图片
+  void setImgList(List<String> list) {
+    state = state.copyWith(imgList: list);
+  }
+
+  //初始化监听
+  void initListener(GaragesalePostPageState initState) {
+
+    // 获取表单的焦点节点
+    final FocusNode focusNode = getFocusNode(state.formData, 'mind');
+
+    focusNode.addListener(() {
+      // 获取焦点的时候清空错误文本
+      if (focusNode.hasFocus) {
+        state = state.copyWith(fieldErrorText: null);
+      }
+    });
+  }
+
+  //销毁资源
+  void onDispose(GaragesalePostPageState initState) {
+    // 获取表单的焦点节点
+    final FocusNode focusNode = getFocusNode(state.formData, 'mind');
+    focusNode.dispose();
+
+    Log.d("GaragesalePostPageState 销毁 onDispose");
+  }
+
+
+}

+ 26 - 0
packages/cpt_community/lib/modules/garagesale/garagesale_post/garagesale_post_vm.g.dart

@@ -0,0 +1,26 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'garagesale_post_vm.dart';
+
+// **************************************************************************
+// RiverpodGenerator
+// **************************************************************************
+
+String _$garagesalePostVmHash() => r'71539a609fdc9da73ac1d354ea881f0ad43eea22';
+
+/// See also [GaragesalePostVm].
+@ProviderFor(GaragesalePostVm)
+final garagesalePostVmProvider = AutoDisposeNotifierProvider<GaragesalePostVm,
+    GaragesalePostPageState>.internal(
+  GaragesalePostVm.new,
+  name: r'garagesalePostVmProvider',
+  debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
+      ? null
+      : _$garagesalePostVmHash,
+  dependencies: null,
+  allTransitiveDependencies: null,
+);
+
+typedef _$GaragesalePostVm = AutoDisposeNotifier<GaragesalePostPageState>;
+// ignore_for_file: type=lint
+// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

+ 42 - 105
packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page.dart

@@ -143,117 +143,54 @@ class NewsfeedPostPage extends HookConsumerWidget {
     final vm = ref.read(newsfeedPostVmProvider.notifier);
     final noteCount = useState(0);
 
-    // return IgnoreKeyboardDismiss(
-    //   child: Container(
-    //     height: 177,
-    //     margin: const EdgeInsets.only(top: 16),
-    //     padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
-    //     decoration: BoxDecoration(
-    //       color: context.appColors.authFiledBG,
-    //       borderRadius: const BorderRadius.all(Radius.circular(5)),
-    //     ),
-    //     child: Stack(
-    //       children: [
-    //         TextField(
-    //           cursorColor: context.appColors.authFiledText,
-    //           cursorWidth: 1.5,
-    //           autofocus: false,
-    //           enabled: true,
-    //           focusNode: state.formData["desc"]!['focusNode'],
-    //           controller: state.formData["desc"]!['controller'],
-    //           decoration: InputDecoration(
-    //             isDense: true,
-    //             isCollapsed: true,
-    //             border: InputBorder.none,
-    //             hintText: state.formData["desc"]!['hintText'],
-    //             hintStyle: TextStyle(
-    //               color: context.appColors.authFiledHint,
-    //               fontSize: 16.0,
-    //               fontWeight: FontWeight.w500,
-    //             ),
-    //           ),
-    //           style: TextStyle(
-    //             color: context.appColors.authFiledText,
-    //             fontSize: 16.0,
-    //             fontWeight: FontWeight.w500,
-    //           ),
-    //           textInputAction: TextInputAction.done,
-    //           onSubmitted: (value) {
-    //             FocusScope.of(context).unfocus();
-    //           },
-    //           maxLines: null,
-    //           expands: true,
-    //           onChanged: (text) {
-    //             // 当文本改变时,更新字符数量
-    //             noteCount.value = text.length;
-    //           },
-    //         ),
-    //         Positioned(
-    //           bottom: 0.0,
-    //           right: 0.0,
-    //           child: Text(
-    //             S.current.characters(noteCount.value),
-    //             style: TextStyle(
-    //               color: context.appColors.textBlack,
-    //               fontSize: 15.0,
-    //             ),
-    //           ),
-    //         ),
-    //       ],
-    //     ),
-    //   ),
-    // );
-
-    return Container(
-      child: Stack(
-        children: [
-          TextField(
-            cursorColor: context.appColors.authFiledText,
-            cursorWidth: 1.5,
-            autofocus: false,
-            enabled: true,
-            maxLines: null,
-            focusNode: state.formData[key]!['focusNode'],
-            controller: state.formData[key]!['controller'],
-            decoration: InputDecoration(
-              isDense: true,
-              isCollapsed: true,
-              border: InputBorder.none,
-              hintText: state.formData[key]!['hintText'],
-              hintStyle: TextStyle(
-                color: context.appColors.authFiledHint,
-                fontSize: 16.0,
-                fontWeight: FontWeight.w500,
-              ),
-            ),
-            style: TextStyle(
-              color: context.appColors.authFiledText,
+    return Stack(
+      children: [
+        TextField(
+          cursorColor: context.appColors.authFiledText,
+          cursorWidth: 1.5,
+          autofocus: false,
+          enabled: true,
+          maxLines: null,
+          focusNode: state.formData[key]!['focusNode'],
+          controller: state.formData[key]!['controller'],
+          decoration: InputDecoration(
+            isDense: true,
+            isCollapsed: true,
+            border: InputBorder.none,
+            hintText: state.formData[key]!['hintText'],
+            hintStyle: TextStyle(
+              color: context.appColors.authFiledHint,
               fontSize: 16.0,
               fontWeight: FontWeight.w500,
             ),
-            textInputAction: TextInputAction.done,
-            onSubmitted: (value) {
-              FocusScope.of(context).unfocus();
-            },
-            expands: true,
-            onChanged: (text) {
-              // 当文本改变时,更新字符数量
-              noteCount.value = text.length;
-            },
           ),
-          Positioned(
-            bottom: 0.0,
-            right: 0.0,
-            child: Text(
-              S.current.characters(noteCount.value),
-              style: TextStyle(
-                color: context.appColors.textBlack,
-                fontSize: 15.0,
-              ),
+          style: TextStyle(
+            color: context.appColors.authFiledText,
+            fontSize: 16.0,
+            fontWeight: FontWeight.w500,
+          ),
+          textInputAction: TextInputAction.done,
+          onSubmitted: (value) {
+            FocusScope.of(context).unfocus();
+          },
+          expands: true,
+          onChanged: (text) {
+            // 当文本改变时,更新字符数量
+            noteCount.value = text.length;
+          },
+        ),
+        Positioned(
+          bottom: 0.0,
+          right: 0.0,
+          child: Text(
+            S.current.characters(noteCount.value),
+            style: TextStyle(
+              color: context.appColors.textBlack,
+              fontSize: 15.0,
             ),
           ),
-        ]
-      ),
+        ),
+      ]
     );
   }
 

+ 0 - 183
packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_page1.dart

@@ -1,183 +0,0 @@
-import 'package:cpt_community/router/page/community_page_router.dart';
-import 'package:cs_resources/theme/app_colors_theme.dart';
-import 'package:flutter/material.dart';
-import 'package:auto_route/auto_route.dart';
-import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:plugin_platform/engine/image/image_nine_grid.dart';
-import 'package:router/ext/auto_router_extensions.dart';
-import 'package:widgets/ext/ex_widget.dart';
-import 'package:widgets/my_appbar.dart';
-import 'package:widgets/my_text_field.dart';
-import 'package:widgets/widget_export.dart';
-import 'package:widgets/my_button.dart';
-
-import 'newsfeed_post_vm.dart';
-
-@RoutePage()
-class NewsfeedPostPage extends HookConsumerWidget {
-  const NewsfeedPostPage({Key? key}) : super(key: key);
-
-  //启动当前页面
-  static void startInstance({BuildContext? context}) {
-    if (context != null) {
-      context.router.push(const NewsfeedPostPageRoute());
-    } else {
-      appRouter.push(const NewsfeedPostPageRoute());
-    }
-  }
-
-  @override
-  Widget build(BuildContext context, WidgetRef ref) {
-    final vm = ref.read(newsfeedPostVmProvider.notifier);
-    final state = ref.watch(newsfeedPostVmProvider);
-
-    return Scaffold(
-      appBar: MyAppBar.appBar(
-        context,
-        "Create Post",
-        backgroundColor: context.appColors.whiteBG,
-      ),
-      backgroundColor: context.appColors.backgroundDefault,
-      body: Column(
-          children: [
-            Expanded(
-                child: SingleChildScrollView(
-                    scrollDirection: Axis.vertical,
-                    physics: const BouncingScrollPhysics(),
-                    clipBehavior: Clip.none,
-                    child: Column(
-                        children: [
-                          // mind textearea
-                          Container(
-                            margin: const EdgeInsets.only(left:15, right:15, top: 20, bottom: 20),
-                            // child: _buildTextArea(context, ref, vm, state),
-                            child: Text("fds"),
-                          ),
-                          Container(
-                            width: double.infinity,
-                            height: 200,
-                            color: Colors.grey,
-                            child: Text("fds"),
-                            // 选择图片上传 控件
-                            // child: _buildImageSelectCmp(context, ref,vm,state),
-                          ),
-                        ]
-                    )
-                )
-            ),
-            // 底部 按钮
-            Container(
-              child: Row(
-                  children: [
-                    Expanded(
-                      child: MyButton(
-                        text: "Add Card",
-                        backgroundColor: context.appColors.textPrimary,
-                        textColor: Colors.white,
-                        fontWeight: FontWeight.w500,
-                        fontSize: 16,
-                        onPressed: (){
-                          // Navigator.pop(context);
-                        },
-                      ),
-                    ),
-                  ]
-              ),
-            )
-          ]
-      ),
-    );
-  }
-
-  /// textarea
-  Widget _buildTextArea(context, ref, vm, state){
-    return Container(
-      width: double.infinity,
-      height: 200,
-      decoration: BoxDecoration(
-          border: Border.all(
-              color: Colors.grey,
-              width: 1
-          ),
-          borderRadius: BorderRadius.circular(10),
-          boxShadow: [
-            BoxShadow(
-              color: Colors.grey.withOpacity(0.5),
-              spreadRadius: 1,
-              blurRadius: 1,
-              offset: const Offset(0, 3), // changes position of shadow
-            ),
-          ]
-      ),
-      child: _buildInputLayout(
-          context,
-          state,
-          'mind'
-      ),
-    );
-  }
-  /// 选择图片上传组件
-  Widget _buildImageSelectCmp(context, ref,vm, state,){
-    return ImageNineGrid(
-      isSelectEnable: true,
-      maxImages: 10,
-      spacing: 10,
-      aspectRatio: 108 / 80,
-      initialImages: state.imgList,
-      onImagesChanged: (list) {
-        vm.setImgList(list);
-      },
-    );
-  }
-
-
-  /// 输入框
-  Widget _buildInputLayout(
-      BuildContext context,
-      state,
-      String key,
-      {
-        double marginTop = 0,
-        bool? showRightIcon = false, //是否展示右侧的布局
-        Widget? rightWidget, //右侧的布局
-        TextInputType textInputType = TextInputType.text,
-        String? errorText,
-        bool obscureText = false,
-        TextInputAction textInputAction = TextInputAction.done,
-        Function? onSubmit,
-      }) {
-    return IgnoreKeyboardDismiss(
-      child: MyTextField(
-        key,
-        fillBackgroundColor: context.appColors.authFiledBG,
-        state.formData[key]!['value'],
-        hintText: state.formData[key]!['hintText'],
-        hintStyle: TextStyle(
-          color: context.appColors.authFiledHint,
-          fontSize: 16.0,
-          fontWeight: FontWeight.w500,
-        ),
-        controller: state.formData[key]!['controller'],
-        focusNode: state.formData[key]!['focusNode'],
-        margin: EdgeInsets.only(top: marginTop),
-        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
-        showDivider: false,
-        height: 44,
-        style: TextStyle(
-          color: context.appColors.authFiledText,
-          fontSize: 16.0,
-          fontWeight: FontWeight.w500,
-        ),
-        inputType: textInputType,
-        textInputAction: textInputAction,
-        onSubmit: onSubmit,
-        cursorColor: context.appColors.authFiledText,
-        obscureText: obscureText,
-        errorText: errorText,
-        showLeftIcon: true,
-        showRightIcon: showRightIcon,
-        rightWidget: rightWidget,
-      ),
-    );
-  }
-}

+ 1 - 1
packages/cpt_community/lib/modules/newsfeed/newsfeed_post/newsfeed_post_vm.g.dart

@@ -6,7 +6,7 @@ part of 'newsfeed_post_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedPostVmHash() => r'a8ecf6c14c636c03fa08a1e050b1f6f6330c5d73';
+String _$newsfeedPostVmHash() => r'cf718a80d333c12dc21a3fed0516d82bf44b7ad1';
 
 /// See also [NewsfeedPostVm].
 @ProviderFor(NewsfeedPostVm)

+ 1 - 1
packages/cpt_community/lib/modules/newsfeed/newsfeed_vm.g.dart

@@ -6,7 +6,7 @@ part of 'newsfeed_vm.dart';
 // RiverpodGenerator
 // **************************************************************************
 
-String _$newsfeedVmHash() => r'8913ddbbe012f28caa65fbc8fdd824a8b818d4c6';
+String _$newsfeedVmHash() => r'dad5087f675a931b393ca884835482454cfd2700';
 
 /// See also [NewsfeedVm].
 @ProviderFor(NewsfeedVm)