defaultinputdecoration.dart 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import 'package:flutter/material.dart';
  2. import 'package:flyinsonolite/infrastructure/scale.dart';
  3. import 'package:flyinsonolite/infrastructure/storage.dart';
  4. class DefaultInputDecoration extends InputDecoration {
  5. DefaultInputDecoration(
  6. {String? placeHolder,
  7. Widget? suffixIcon,
  8. EdgeInsetsGeometry? contentPadding,
  9. String errorText = '',
  10. Color? fillColor,
  11. Color? borderColor,
  12. Color? enabledBorderColor,
  13. BoxConstraints? constraints})
  14. : super(
  15. fillColor: fillColor ?? Colors.white,
  16. filled: true,
  17. hintText: placeHolder,
  18. hintStyle: TextStyle(
  19. color: const Color.fromARGB(255, 194, 198, 205),
  20. fontSize: Storage.currentTheme.normalTextStyle.fontSize!.s),
  21. contentPadding:
  22. contentPadding ?? EdgeInsets.fromLTRB(12.s, 4.s, 12.s, 4.s),
  23. border: OutlineInputBorder(
  24. borderRadius: BorderRadius.circular(4.s),
  25. gapPadding: 4.s,
  26. borderSide: BorderSide(
  27. color:
  28. borderColor ?? const Color.fromARGB(255, 233, 234, 239),
  29. width: 0)),
  30. enabledBorder: OutlineInputBorder(
  31. //未选中时候的颜色
  32. borderRadius: BorderRadius.circular(4.s),
  33. gapPadding: 4.s,
  34. borderSide: BorderSide(
  35. color:
  36. borderColor ?? const Color.fromARGB(255, 225, 227, 233),
  37. width: 0)),
  38. focusedBorder: OutlineInputBorder(
  39. //选中时外边框颜色
  40. borderRadius: BorderRadius.circular(4.s),
  41. gapPadding: 4.s,
  42. borderSide: BorderSide(
  43. color: Storage.currentTheme.loginContainStyle.borderColor,
  44. width: 0)),
  45. errorText: errorText == '' ? null : errorText,
  46. suffixIcon: suffixIcon,
  47. suffixIconConstraints: BoxConstraints(
  48. minWidth: 48.s, minHeight: 48.s, maxHeight: 48.s, maxWidth: 48.s),
  49. constraints:
  50. constraints ?? BoxConstraints(minHeight: 48.s, maxHeight: 48.s),
  51. );
  52. }
  53. class DefaultInputDecoration2 extends InputDecoration {
  54. DefaultInputDecoration2({
  55. EdgeInsetsGeometry? contentPadding,
  56. }) : super(
  57. contentPadding: contentPadding ?? const EdgeInsets.all(0),
  58. border: OutlineInputBorder(
  59. borderRadius: BorderRadius.circular(4.s),
  60. gapPadding: 4.s,
  61. borderSide: BorderSide(color: Colors.grey, width: 1.s)),
  62. enabledBorder: OutlineInputBorder(
  63. //未选中时候的颜色
  64. borderRadius: BorderRadius.circular(4.s),
  65. gapPadding: 4.s,
  66. borderSide: BorderSide(color: Colors.grey, width: 1.s)),
  67. focusedBorder: OutlineInputBorder(
  68. //选中时外边框颜色
  69. borderRadius: BorderRadius.circular(4.s),
  70. gapPadding: 4.s,
  71. borderSide: BorderSide(color: Colors.blue, width: 1.s)),
  72. );
  73. }