comments_input.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import 'package:cpt_community/modules/community/newsfeed_detail/newsfeed_detail_vm.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_hooks/flutter_hooks.dart';
  6. import 'package:hooks_riverpod/hooks_riverpod.dart';
  7. import 'package:shared/utils/log_utils.dart';
  8. import 'package:widgets/my_text_view.dart';
  9. /// 多行输入框
  10. class CommentsTextareaInput extends HookConsumerWidget {
  11. bool showCounter = true;
  12. CommentsTextareaInput({Key? key,this.showCounter = true}): super(key: key);
  13. @override
  14. Widget build(BuildContext context, WidgetRef ref) {
  15. final state = ref.watch(newsfeedDetailVmProvider);
  16. final vm = ref.read(newsfeedDetailVmProvider.notifier);
  17. final noteCount = useState(0);
  18. return _buildTextAreaLayout(context, ref, state, vm, noteCount);
  19. }
  20. Widget _buildTextAreaLayout(BuildContext context, ref, state, vm , noteCount){
  21. Log.d("----898989----${state.commentFieldInfo}-----");
  22. // return Text('角度看是否 ${state.commentFieldInfo['hintText']}');
  23. return Stack(
  24. children: [
  25. Text("发的时刻减肥的"),
  26. ]
  27. );
  28. // Row(
  29. // mainAxisSize: MainAxisSize.max,
  30. // children: [
  31. // Expanded(
  32. // child: Stack(
  33. // children: [
  34. // TextField(
  35. // cursorColor: context.appColors.authFiledText,
  36. // cursorWidth: 1.5,
  37. // autofocus: false,
  38. // enabled: true,
  39. // maxLines: null,
  40. // focusNode: state.commentFieldInfo['focusNode'],
  41. // controller: state.commentFieldInfo!['controller'],
  42. // decoration: InputDecoration(
  43. // isDense: true,
  44. // isCollapsed: true,
  45. // border: InputBorder.none,
  46. // hintText: state.commentFieldInfo!['hintText'],
  47. // hintStyle: TextStyle(
  48. // color: context.appColors.authFiledHint,
  49. // fontSize: 16.0,
  50. // fontWeight: FontWeight.w500,
  51. // ),
  52. // ),
  53. // style: TextStyle(
  54. // color: context.appColors.authFiledText,
  55. // fontSize: 16.0,
  56. // fontWeight: FontWeight.w500,
  57. // ),
  58. // textInputAction: TextInputAction.done,
  59. // onSubmitted: (value) {
  60. // // FocusScope.of(context).unfocus();
  61. // },
  62. // expands: true,
  63. // onChanged: (text) {
  64. // // 当文本改变时,更新字符数量
  65. // if(showCounter){
  66. // noteCount.value = text.length;
  67. // }
  68. // },
  69. // ),
  70. // Visibility(
  71. // visible: showCounter,
  72. // child: Positioned(
  73. // bottom: 0.0,
  74. // right: 0.0,
  75. // child: Text(
  76. // S.current.characters(noteCount.value),
  77. // style: TextStyle(
  78. // color: context.appColors.textBlack,
  79. // fontSize: 15.0,
  80. // ),
  81. // ),
  82. // ),
  83. // ),
  84. // ]
  85. // ),
  86. // ),
  87. // ],
  88. // );
  89. }
  90. }