attach_input_widget.dart 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import 'package:cpt_auth/modules/select_estate/select_estate_view_model.dart';
  2. import 'package:cs_resources/theme/app_colors_theme.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:flutter_riverpod/flutter_riverpod.dart';
  5. import 'package:hooks_riverpod/hooks_riverpod.dart';
  6. import 'package:widgets/ext/ex_widget.dart';
  7. import 'package:widgets/my_text_field.dart';
  8. import 'package:widgets/widget_export.dart';
  9. //输入框的布局,单独抽取为了做Attach弹窗
  10. class AttachInputWidget extends HookConsumerWidget {
  11. final void Function(BuildContext context, String value) onChanged;
  12. AttachInputWidget({
  13. required this.onChanged,
  14. });
  15. @override
  16. Widget build(BuildContext context, WidgetRef ref) {
  17. final state = ref.watch(selectEstateViewModelProvider);
  18. return IgnoreKeyboardDismiss(
  19. child: MyTextField(
  20. "estate",
  21. key: key,
  22. fillBackgroundColor: context.appColors.authFiledBG,
  23. "",
  24. hintText: state.formData['estate']!['hintText'],
  25. hintStyle: TextStyle(
  26. color: context.appColors.authFiledHint,
  27. fontSize: 16.0,
  28. fontWeight: FontWeight.w500,
  29. ),
  30. controller: state.formData['estate']!['controller'],
  31. focusNode: state.formData['estate']!['focusNode'],
  32. margin: const EdgeInsets.only(top: 0),
  33. padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 3),
  34. showDivider: false,
  35. height: 44,
  36. style: TextStyle(
  37. color: context.appColors.authFiledText,
  38. fontSize: 16.0,
  39. fontWeight: FontWeight.w500,
  40. ),
  41. inputType: TextInputType.text,
  42. textInputAction: TextInputAction.done,
  43. onChanged: (k, v) {
  44. onChanged.call(context, v);
  45. },
  46. changeActionType: ClickType.debounce,
  47. changeActionMilliseconds: 500,
  48. cursorColor: context.appColors.authFiledText,
  49. obscureText: false,
  50. errorText: null,
  51. showLeftIcon: true,
  52. showRightIcon: false,
  53. rightWidget: null,
  54. ),
  55. );
  56. }
  57. }