You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.8 KiB

2 years ago
  1. import 'package:flutter/material.dart';
  2. import 'package:hexcolor/hexcolor.dart';
  3. class ThemeHelper{
  4. InputDecoration textInputDecoration([String lableText="", String hintText = ""]){
  5. return InputDecoration(
  6. labelText: lableText,
  7. hintText: hintText,
  8. fillColor: Colors.white,
  9. filled: true,
  10. contentPadding: EdgeInsets.fromLTRB(20, 10, 20, 10),
  11. focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide(color: Colors.grey)),
  12. enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide(color: Colors.grey.shade400)),
  13. errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide(color: Colors.red, width: 2.0)),
  14. focusedErrorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(100.0), borderSide: BorderSide(color: Colors.red, width: 2.0)),
  15. );
  16. }
  17. BoxDecoration inputBoxDecorationShaddow() {
  18. return BoxDecoration(boxShadow: [
  19. BoxShadow(
  20. color: Colors.black.withOpacity(0.7),
  21. blurRadius: 20,
  22. offset: const Offset(0, 5),
  23. )
  24. ]);
  25. }
  26. BoxDecoration buttonBoxDecoration(BuildContext context, [String color1 = "", String color2 = ""]) {
  27. Color c1 = Theme.of(context).primaryColor;
  28. Color c2 = Theme.of(context).accentColor;
  29. if (color1.isEmpty == false) {
  30. c1 = HexColor(color1);
  31. }
  32. if (color2.isEmpty == false) {
  33. c2 = HexColor(color2);
  34. }
  35. return BoxDecoration(
  36. boxShadow: [
  37. BoxShadow(color: Colors.black26, offset: Offset(0, 4), blurRadius: 5.0)
  38. ],
  39. gradient: LinearGradient(
  40. begin: Alignment.topLeft,
  41. end: Alignment.bottomRight,
  42. stops: [0.0, 1.0],
  43. colors: [
  44. c1,
  45. c2,
  46. ],
  47. ),
  48. color: Colors.deepPurple.shade300,
  49. borderRadius: BorderRadius.circular(30),
  50. );
  51. }
  52. ButtonStyle buttonStyle() {
  53. return ButtonStyle(
  54. shape: MaterialStateProperty.all<RoundedRectangleBorder>(
  55. RoundedRectangleBorder(
  56. borderRadius: BorderRadius.circular(30.0),
  57. ),
  58. ),
  59. minimumSize: MaterialStateProperty.all(Size(50, 50)),
  60. backgroundColor: MaterialStateProperty.all(Colors.transparent),
  61. shadowColor: MaterialStateProperty.all(Colors.transparent),
  62. );
  63. }
  64. AlertDialog alartDialog(String title, String content, BuildContext context) {
  65. return AlertDialog(
  66. title: Text(title),
  67. content: Text(content),
  68. actions: [
  69. TextButton(
  70. child: Text(
  71. "OK",
  72. style: TextStyle(color: Colors.white),
  73. ),
  74. style: ButtonStyle(
  75. backgroundColor: MaterialStateProperty.all(Colors.black38)),
  76. onPressed: () {
  77. Navigator.of(context).pop();
  78. },
  79. ),
  80. ],
  81. );
  82. }
  83. }
  84. class LoginFormStyle{
  85. }