@@ -2,25 +2,105 @@ import 'package:flutter/material.dart';
2
2
import 'package:nylo_framework/nylo_framework.dart' ;
3
3
4
4
class FormStyle extends NyFormStyle {
5
-
6
5
/// TextField styles
7
- // @override
8
- // FormStyleTextField textField(BuildContext context, Field field) {
9
- // return {
10
- // 'custom_style': (textField) => textField.copyWith(
11
- //
12
- // ),
13
- // 'default': (NyTextField textField) => textField.copyWith(
14
- // decoration: InputDecoration(
15
- // border: InputBorder.none,
16
- // filled: true,
17
- // fillColor: Colors.blue.shade100,
18
- // labelText: field.name,
19
- // hintText: 'Enter ${field.name}',
20
- // ),
21
- // ),
22
- // };
23
- // }
6
+ @override
7
+ FormStyleTextField textField (BuildContext context, Field field) {
8
+ return {
9
+ 'minimal' : (NyTextField textField) => textField.copyWith (
10
+ decorator: DecoratorTextField (
11
+ decoration: (dynamic data, InputDecoration inputDecoration) =>
12
+ inputDecoration.copyWith (
13
+ filled: true ,
14
+ fillColor: Colors .grey.shade100,
15
+ isDense: true ,
16
+ hintText: "${field .name }" ,
17
+ focusedBorder: OutlineInputBorder (
18
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
19
+ borderSide: BorderSide (color: Colors .red, width: 2 )),
20
+ enabledBorder: OutlineInputBorder (
21
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
22
+ borderSide: BorderSide (color: Colors .transparent)),
23
+ contentPadding:
24
+ EdgeInsetsDirectional .symmetric (vertical: 13 , horizontal: 13 ),
25
+ border: OutlineInputBorder (
26
+ borderRadius: BorderRadius .circular (12 ),
27
+ borderSide: const BorderSide (
28
+ width: 0 ,
29
+ style: BorderStyle .none,
30
+ ),
31
+ ),
32
+ ),
33
+ successDecoration:
34
+ (dynamic data, InputDecoration inputDecoration) =>
35
+ inputDecoration.copyWith (
36
+ prefixIcon: Icon (Icons .person),
37
+ focusedBorder: OutlineInputBorder (
38
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
39
+ borderSide: BorderSide (color: Colors .green, width: 2 )),
40
+ enabledBorder: OutlineInputBorder (
41
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
42
+ borderSide: BorderSide (color: Colors .green, width: 2 ),
43
+ ),
44
+ ),
45
+ errorDecoration: (dynamic data, InputDecoration inputDecoration) =>
46
+ inputDecoration.copyWith (
47
+ focusedErrorBorder: OutlineInputBorder (
48
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
49
+ borderSide: BorderSide (color: Colors .orange, width: 2 ),
50
+ ),
51
+ errorStyle: TextStyle (color: Colors .red),
52
+ errorBorder: OutlineInputBorder (
53
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
54
+ borderSide: BorderSide (color: Colors .orange, width: 2 ),
55
+ ),
56
+ border: InputBorder .none),
57
+ )),
58
+ 'default' : (NyTextField textField) => textField.copyWith (
59
+ decorator: DecoratorTextField (
60
+ decoration: (dynamic data, InputDecoration inputDecoration) =>
61
+ inputDecoration.copyWith (
62
+ filled: true ,
63
+ fillColor: Colors .grey.shade100,
64
+ isDense: true ,
65
+ hintText: "${field .name }" ,
66
+ focusedBorder: OutlineInputBorder (
67
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
68
+ borderSide: BorderSide (color: Colors .transparent)),
69
+ enabledBorder: OutlineInputBorder (
70
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
71
+ borderSide: BorderSide (color: Colors .transparent)),
72
+ contentPadding:
73
+ EdgeInsetsDirectional .symmetric (vertical: 13 , horizontal: 13 ),
74
+ border: OutlineInputBorder (
75
+ borderRadius: BorderRadius .circular (12 ),
76
+ borderSide: const BorderSide (
77
+ width: 0 ,
78
+ style: BorderStyle .none,
79
+ ),
80
+ ),
81
+ ),
82
+ successDecoration:
83
+ (dynamic data, InputDecoration inputDecoration) =>
84
+ inputDecoration.copyWith (
85
+ focusedBorder: OutlineInputBorder (
86
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
87
+ borderSide: BorderSide (color: Colors .green, width: 2 )),
88
+ ),
89
+ errorDecoration: (dynamic data, InputDecoration inputDecoration) =>
90
+ inputDecoration.copyWith (
91
+ focusedErrorBorder: OutlineInputBorder (
92
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
93
+ borderSide: BorderSide (color: Colors .orange, width: 2 ),
94
+ ),
95
+ errorStyle: TextStyle (color: Colors .red),
96
+ errorBorder: OutlineInputBorder (
97
+ borderRadius: BorderRadius .all (Radius .circular (12 )),
98
+ borderSide: BorderSide (color: Colors .orange, width: 2 ),
99
+ ),
100
+ ),
101
+ )),
102
+ };
103
+ }
24
104
25
105
/// Checkbox styles
26
106
// @override
@@ -31,4 +111,4 @@ class FormStyle extends NyFormStyle {
31
111
// ),
32
112
// };
33
113
// }
34
- }
114
+ }
0 commit comments