|
1 | 1 | import 'package:flutter/material.dart';
|
2 |
| -import 'loaders/color_loader.dart'; |
3 |
| -import 'loaders/color_loader_2.dart'; |
4 |
| -import 'loaders/color_loader_3.dart'; |
5 |
| -import 'loaders/color_loader_4.dart'; |
6 |
| -import 'loaders/color_loader_5.dart'; |
7 |
| -import 'package:flutter_login_screens/loaders/dot_type.dart'; |
| 2 | +import 'package:flutter_login_screens/misc/rating.dart'; |
8 | 3 |
|
9 | 4 | void main() => runApp(new MyApp());
|
10 | 5 |
|
@@ -35,84 +30,217 @@ class _MyHomePageState extends State<MyHomePage> {
|
35 | 30 | Colors.pinkAccent,
|
36 | 31 | Colors.blue
|
37 | 32 | ];
|
| 33 | + List<int> _ratings = [ |
| 34 | + 4, |
| 35 | + 2, |
| 36 | + 3, |
| 37 | + 4, |
| 38 | + 3, |
| 39 | + 5, |
| 40 | + 2, |
| 41 | + ]; |
38 | 42 |
|
39 | 43 | @override
|
40 | 44 | Widget build(BuildContext context) {
|
41 | 45 | return Scaffold(
|
42 |
| - backgroundColor: Colors.white, |
43 |
| - body: Container( |
44 |
| - child: new Column( |
45 |
| - children: <Widget>[ |
46 |
| - Divider( |
47 |
| - height: 50.0, |
48 |
| - color: Colors.white, |
49 |
| - ), |
50 |
| - ColorLoader(colors: colors, duration: Duration(milliseconds: 1200)), |
51 |
| - Divider( |
52 |
| - height: 20.0, |
53 |
| - color: Colors.white, |
54 |
| - ), |
55 |
| - ColorLoader3( |
56 |
| - radius: 15.0, |
57 |
| - dotRadius: 6.0, |
58 |
| - ), |
59 |
| - ColorLoader3( |
60 |
| - radius: 20.0, |
61 |
| - dotRadius: 5.0, |
62 |
| - ), |
63 |
| - Divider(height: 20.0, color: Colors.white), |
64 |
| - ColorLoader2(), |
65 |
| - Divider( |
66 |
| - height: 50.0, |
67 |
| - color: Colors.white, |
68 |
| - ), |
69 |
| - ColorLoader4(), |
70 |
| - Divider( |
71 |
| - height: 45.0, |
72 |
| - color: Colors.white, |
73 |
| - ), |
74 |
| - ColorLoader4( |
75 |
| - dotOneColor: Colors.pink, |
76 |
| - dotTwoColor: Colors.amber, |
77 |
| - dotThreeColor: Colors.deepOrange, |
78 |
| - dotType: DotType.square, |
79 |
| - duration: Duration(milliseconds: 1200), |
80 |
| - ), |
81 |
| - Divider( |
82 |
| - height: 45.0, |
83 |
| - color: Colors.white, |
84 |
| - ), |
85 |
| - ColorLoader4( |
86 |
| - dotOneColor: Colors.pink, |
87 |
| - dotTwoColor: Colors.amber, |
88 |
| - dotThreeColor: Colors.deepOrange, |
89 |
| - duration: Duration(seconds: 2), |
90 |
| - ), |
91 |
| - Divider( |
92 |
| - height: 50.0, |
93 |
| - color: Colors.white, |
94 |
| - ), |
95 |
| - ColorLoader4( |
96 |
| - dotOneColor: Colors.indigoAccent, |
97 |
| - dotTwoColor: Colors.teal, |
98 |
| - dotThreeColor: Colors.pink, |
99 |
| - dotType: DotType.diamond, |
100 |
| - duration: Duration(milliseconds: 1500), |
101 |
| - ), |
102 |
| - Divider( |
103 |
| - height: 45.0, |
104 |
| - color: Colors.white, |
105 |
| - ), |
106 |
| - ColorLoader5( |
107 |
| - dotOneColor: Colors.redAccent, |
108 |
| - dotTwoColor: Colors.blueAccent, |
109 |
| - dotThreeColor: Colors.green, |
110 |
| - dotType: DotType.circle, |
111 |
| - dotIcon: Icon(Icons.adjust), |
112 |
| - duration: Duration(seconds: 1), |
113 |
| - ) |
114 |
| - ], |
115 |
| - ),) |
116 |
| - ); |
| 46 | + backgroundColor: Colors.white, |
| 47 | + body: Container( |
| 48 | + child: new Column( |
| 49 | + mainAxisAlignment: MainAxisAlignment.start, |
| 50 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 51 | + children: <Widget>[ |
| 52 | + Divider( |
| 53 | + height: 50.0, |
| 54 | + color: Colors.white, |
| 55 | + ), |
| 56 | +//// ColorLoader(colors: colors, duration: Duration(milliseconds: 1200)), |
| 57 | +//// Divider( |
| 58 | +//// height: 20.0, |
| 59 | +//// color: Colors.white, |
| 60 | +//// ), |
| 61 | +//// ColorLoader3( |
| 62 | +//// radius: 15.0, |
| 63 | +//// dotRadius: 6.0, |
| 64 | +//// ), |
| 65 | +//// ColorLoader3( |
| 66 | +//// radius: 20.0, |
| 67 | +//// dotRadius: 5.0, |
| 68 | +//// ), |
| 69 | +//// Divider(height: 20.0, color: Colors.white), |
| 70 | +//// ColorLoader2(), |
| 71 | +//// Divider( |
| 72 | +//// height: 50.0, |
| 73 | +//// color: Colors.white, |
| 74 | +//// ), |
| 75 | +//// ColorLoader4(), |
| 76 | +//// Divider( |
| 77 | +//// height: 45.0, |
| 78 | +//// color: Colors.white, |
| 79 | +//// ), |
| 80 | +//// ColorLoader4( |
| 81 | +//// dotOneColor: Colors.pink, |
| 82 | +//// dotTwoColor: Colors.amber, |
| 83 | +//// dotThreeColor: Colors.deepOrange, |
| 84 | +//// dotType: DotType.square, |
| 85 | +//// duration: Duration(milliseconds: 1200), |
| 86 | +//// ), |
| 87 | +//// Divider( |
| 88 | +//// height: 45.0, |
| 89 | +//// color: Colors.white, |
| 90 | +//// ), |
| 91 | +//// ColorLoader4( |
| 92 | +//// dotOneColor: Colors.pink, |
| 93 | +//// dotTwoColor: Colors.amber, |
| 94 | +//// dotThreeColor: Colors.deepOrange, |
| 95 | +//// duration: Duration(seconds: 2), |
| 96 | +//// ), |
| 97 | +//// Divider( |
| 98 | +//// height: 50.0, |
| 99 | +//// color: Colors.white, |
| 100 | +//// ), |
| 101 | +//// ColorLoader4( |
| 102 | +//// dotOneColor: Colors.indigoAccent, |
| 103 | +//// dotTwoColor: Colors.teal, |
| 104 | +//// dotThreeColor: Colors.pink, |
| 105 | +//// dotType: DotType.diamond, |
| 106 | +//// duration: Duration(milliseconds: 1500), |
| 107 | +//// ), |
| 108 | +//// Divider( |
| 109 | +//// height: 45.0, |
| 110 | +//// color: Colors.white, |
| 111 | +//// ), |
| 112 | +//// ColorLoader5( |
| 113 | +//// dotOneColor: Colors.redAccent, |
| 114 | +//// dotTwoColor: Colors.blueAccent, |
| 115 | +//// dotThreeColor: Colors.green, |
| 116 | +//// dotType: DotType.circle, |
| 117 | +//// dotIcon: Icon(Icons.adjust), |
| 118 | +//// duration: Duration(seconds: 1), |
| 119 | +//// ) |
| 120 | +
|
| 121 | + Row( |
| 122 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 123 | + children: <Widget>[ |
| 124 | + Rating( |
| 125 | + initialRating: _ratings[0], |
| 126 | + size: 24.0, |
| 127 | + color: Colors.redAccent, |
| 128 | + onRated: (int value) { |
| 129 | + setState(() { |
| 130 | + _ratings[0] = value; |
| 131 | + }); |
| 132 | + }, |
| 133 | + ), |
| 134 | + Padding( |
| 135 | + padding: const EdgeInsets.all(8.0), |
| 136 | + child: Text( |
| 137 | + _ratings[0].toString(), |
| 138 | + style: TextStyle( |
| 139 | + fontSize: 24.0, |
| 140 | + ), |
| 141 | + ), |
| 142 | + ) |
| 143 | + ], |
| 144 | + ), |
| 145 | + Row( |
| 146 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 147 | + children: <Widget>[ |
| 148 | + Rating( |
| 149 | + initialRating: _ratings[1], |
| 150 | + size: 36.0, |
| 151 | + color: Colors.blueAccent, |
| 152 | + onRated: (int value) { |
| 153 | + setState(() { |
| 154 | + _ratings[1] = value; |
| 155 | + }); |
| 156 | + }, |
| 157 | + ), |
| 158 | + Padding( |
| 159 | + padding: const EdgeInsets.all(8.0), |
| 160 | + child: Text( |
| 161 | + _ratings[1].toString(), |
| 162 | + style: TextStyle( |
| 163 | + fontSize: 24.0, |
| 164 | + ), |
| 165 | + ), |
| 166 | + ) |
| 167 | + ], |
| 168 | + ), |
| 169 | + |
| 170 | + Row( |
| 171 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 172 | + children: <Widget>[ |
| 173 | + Rating( |
| 174 | + initialRating: _ratings[2], |
| 175 | + size: 48.0, |
| 176 | + color: Colors.amber, |
| 177 | + onRated: (int value) { |
| 178 | + setState(() { |
| 179 | + _ratings[2] = value; |
| 180 | + }); |
| 181 | + }, |
| 182 | + ), |
| 183 | + Padding( |
| 184 | + padding: const EdgeInsets.all(8.0), |
| 185 | + child: Text( |
| 186 | + _ratings[2].toString(), |
| 187 | + style: TextStyle( |
| 188 | + fontSize: 24.0, |
| 189 | + ), |
| 190 | + ), |
| 191 | + ) |
| 192 | + ], |
| 193 | + ), |
| 194 | + Row( |
| 195 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 196 | + children: <Widget>[ |
| 197 | + Rating( |
| 198 | + initialRating: _ratings[4], |
| 199 | + size: 36.0, |
| 200 | + color: Colors.green, |
| 201 | + onRated: (int value) { |
| 202 | + setState(() { |
| 203 | + _ratings[4] = value; |
| 204 | + }); |
| 205 | + }, |
| 206 | + ), |
| 207 | + Padding( |
| 208 | + padding: const EdgeInsets.all(8.0), |
| 209 | + child: Text( |
| 210 | + _ratings[4].toString(), |
| 211 | + style: TextStyle( |
| 212 | + fontSize: 24.0, |
| 213 | + ), |
| 214 | + ), |
| 215 | + ) |
| 216 | + ], |
| 217 | + ), |
| 218 | + Row( |
| 219 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 220 | + children: <Widget>[ |
| 221 | + Rating( |
| 222 | + initialRating: _ratings[5], |
| 223 | + size: 18.0, |
| 224 | + color: Colors.deepPurple, |
| 225 | + onRated: (int value) { |
| 226 | + setState(() { |
| 227 | + _ratings[5] = value; |
| 228 | + }); |
| 229 | + }, |
| 230 | + ), |
| 231 | + Padding( |
| 232 | + padding: const EdgeInsets.all(8.0), |
| 233 | + child: Text( |
| 234 | + _ratings[5].toString(), |
| 235 | + style: TextStyle( |
| 236 | + fontSize: 24.0, |
| 237 | + ), |
| 238 | + ), |
| 239 | + ) |
| 240 | + ], |
| 241 | + ), |
| 242 | + ], |
| 243 | + ), |
| 244 | + )); |
117 | 245 | }
|
118 | 246 | }
|
0 commit comments