@@ -78,34 +78,90 @@ class _HomePageState extends State<HomePage> {
7878
7979 // Increment/Decrement Page
8080 Widget _buildIncrementDecrementPage (BuildContext context) {
81- int quantity = 1 ;
82-
8381 return StatefulBuilder (
8482 builder: (context, setState) {
83+ int quantity1 = 1 ;
84+ int quantity2 = 5 ;
85+ int quantity3 = 8 ;
86+
8587 return PaddedChildrenList (
8688 children: [
8789 Text (
8890 'Increment/Decrement Widget' ,
8991 style: Theme .of (context).textTheme.titleLarge,
9092 ),
91- IncrementDecrementWidget (
92- quantity: quantity,
93- maxQuantity: 10 ,
94- minValue: 1 ,
95- onIncrement: () {
96- setState (() {
97- if (quantity < 10 ) quantity++ ;
98- });
93+ const SizedBox (height: 16 ),
94+
95+ // Flat Example
96+ StatefulBuilder (
97+ builder: (context, setState) {
98+ return IncrementDecrementWidget .flat (
99+ quantity: quantity1,
100+ maxQuantity: 10 ,
101+ minValue: 1 ,
102+ onIncrement: () {
103+ setState (() {
104+ if (quantity1 < 10 ) quantity1++ ;
105+ });
106+ },
107+ onDecrement: () {
108+ setState (() {
109+ if (quantity1 > 1 ) quantity1-- ;
110+ });
111+ },
112+ backgroundColor: Colors .grey[200 ],
113+ iconColor: Colors .blue,
114+ );
99115 },
100- onDecrement: () {
101- setState (() {
102- if (quantity > 1 ) quantity-- ;
103- });
116+ ),
117+
118+ const SizedBox (height: 16 ),
119+
120+ // Raised Example
121+ StatefulBuilder (
122+ builder: (context, setState) {
123+ return IncrementDecrementWidget .raised (
124+ quantity: quantity2,
125+ maxQuantity: 15 ,
126+ minValue: 0 ,
127+ onIncrement: () {
128+ setState (() {
129+ if (quantity2 < 15 ) quantity2++ ;
130+ });
131+ },
132+ onDecrement: () {
133+ setState (() {
134+ if (quantity2 > 0 ) quantity2-- ;
135+ });
136+ },
137+ backgroundColor: Colors .lightGreen[100 ],
138+ iconColor: Colors .green,
139+ );
140+ },
141+ ),
142+
143+ const SizedBox (height: 16 ),
144+
145+ // Minimal Example
146+ StatefulBuilder (
147+ builder: (context, setState) {
148+ return IncrementDecrementWidget .minimal (
149+ quantity: quantity3,
150+ maxQuantity: 20 ,
151+ minValue: 5 ,
152+ onIncrement: () {
153+ setState (() {
154+ if (quantity3 < 20 ) quantity3++ ;
155+ });
156+ },
157+ onDecrement: () {
158+ setState (() {
159+ if (quantity3 > 5 ) quantity3-- ;
160+ });
161+ },
162+ iconColor: Colors .red,
163+ );
104164 },
105- backgroundColor: Colors .grey[200 ],
106- iconColor: Colors .blue,
107- elevation: 4.0 ,
108- margin: const EdgeInsets .all (8.0 ),
109165 ),
110166 ],
111167 );
@@ -122,10 +178,12 @@ class _HomePageState extends State<HomePage> {
122178 return PaddedChildrenList (
123179 children: [
124180 Text (
125- 'Custom Action Button ' ,
181+ 'Custom Action Buttons ' ,
126182 style: Theme .of (context).textTheme.titleLarge,
127183 ),
128- CustomActionButton (
184+ const SizedBox (height: 16 ),
185+ // Raised Button Example
186+ CustomActionButton .raised (
129187 onPressed: () {
130188 setState (() {
131189 counter++ ;
@@ -135,9 +193,34 @@ class _HomePageState extends State<HomePage> {
135193 borderColor: Colors .blueAccent,
136194 elevation: 4.0 ,
137195 borderRadius: 8.0 ,
138- child: Text ('Custom Action Button ($counter )' ,
196+ child: Text ('Raised Button ($counter )' ,
139197 style: const TextStyle (color: Colors .white)),
140198 ),
199+ const SizedBox (height: 16 ),
200+ // Flat Button Example
201+ CustomActionButton .flat (
202+ onPressed: () {
203+ setState (() {
204+ counter++ ;
205+ });
206+ },
207+ backgroundColor: Colors .green,
208+ borderColor: Colors .transparent,
209+ borderRadius: 8.0 ,
210+ child: Text ('Flat Button ($counter )' ,
211+ style: const TextStyle (color: Colors .white)),
212+ ),
213+ const SizedBox (height: 16 ),
214+ // Minimal Button Example
215+ CustomActionButton .minimal (
216+ onPressed: () {
217+ setState (() {
218+ counter++ ;
219+ });
220+ },
221+ child: Text ('Minimal Button ($counter )' ,
222+ style: const TextStyle (color: Colors .black)),
223+ ),
141224 ],
142225 );
143226 },
0 commit comments