Hibok
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

96 lignes
2.6 KiB

  1. import 'package:flutter/material.dart';
  2. import '../data/constants.dart' show Constants, AppColors;
  3. class FullWidthButton extends StatelessWidget {
  4. static const Hor_Padding = 5.0;
  5. static const Ver_Padding = 10.0;
  6. final String title;
  7. final bool showDivider;
  8. final VoidCallback onPressed;
  9. final String description;
  10. final Color descriptionColor;
  11. final bool showRightIcon;
  12. final Widget extendWidget;
  13. const FullWidthButton(
  14. {@required this.title,
  15. this.description = '',
  16. @required this.onPressed,
  17. this.descriptionColor,
  18. this.showRightIcon: true,
  19. this.showDivider: false,
  20. this.extendWidget
  21. })
  22. : assert(title != null),
  23. assert(onPressed != null);
  24. @override
  25. Widget build(BuildContext context) {
  26. final pureButton = Row(
  27. mainAxisAlignment: MainAxisAlignment.start,
  28. crossAxisAlignment: CrossAxisAlignment.center,
  29. children: <Widget>[
  30. SizedBox(width: Hor_Padding),
  31. Expanded(
  32. child: Text(
  33. title,
  34. textScaleFactor: 1.0,
  35. style: TextStyle(
  36. fontSize: 14,
  37. fontWeight: FontWeight.normal
  38. ),
  39. ),
  40. ),
  41. extendWidget!=null?extendWidget: Text(
  42. description,
  43. textScaleFactor: 1.0,
  44. textAlign: TextAlign.end,
  45. style: TextStyle(
  46. fontSize: 12,
  47. fontWeight: FontWeight.normal,
  48. color: descriptionColor == null
  49. ? const Color(0xFF818181)
  50. : descriptionColor),
  51. ),
  52. showRightIcon
  53. ? Padding(
  54. padding: EdgeInsets.only(bottom: 1.5),
  55. child: Icon(
  56. IconData(0xe63c, fontFamily: 'iconfont'),
  57. size: 20.0,
  58. color: Color(AppColors.TabIconNormal),
  59. ))
  60. : Padding(padding: EdgeInsets.only(right: 7)),
  61. ],
  62. );
  63. final borderButton = Container(
  64. decoration: BoxDecoration(
  65. border: Border(
  66. bottom: Constants.GreyBorderSide,
  67. ),
  68. ),
  69. padding: EdgeInsets.only(
  70. bottom: Ver_Padding,
  71. ),
  72. child: pureButton,
  73. );
  74. return FlatButton(
  75. onPressed: () {
  76. this.onPressed();
  77. },
  78. padding: EdgeInsets.only(
  79. left: Hor_Padding,
  80. right: Hor_Padding,
  81. top: Ver_Padding,
  82. bottom: showDivider ? 0.0 : Ver_Padding,
  83. ),
  84. color: Colors.white,
  85. child: showDivider ? borderButton : pureButton,
  86. );
  87. }
  88. }