Skip to content

Commit ba3f569

Browse files
author
Vivek Chib
committed
minor refactoring to home page and graph widget
1 parent 807c324 commit ba3f569

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

lib/views/home_page.dart

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
119119
final double spacing = screenMode.spacing;
120120

121121
final animationWidget = Column(
122+
spacing: spacing,
123+
mainAxisAlignment: MainAxisAlignment.start,
124+
mainAxisSize: MainAxisSize.min,
122125
children: [
123126
// Graph
124127
GraphWidget(
@@ -128,6 +131,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
128131

129132
// Box Animations
130133
AnimationBoxes(curveAnimation: curveAnimation),
134+
SizedBox(height: spacing * 2),
131135
],
132136
);
133137

@@ -214,30 +218,31 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
214218
),
215219
),
216220
),
217-
body: SingleChildScrollView(
218-
child: Container(
219-
alignment: Alignment.center,
220-
width: MediaQuery.of(context).size.width,
221-
padding: const EdgeInsets.symmetric(horizontal: 16.0),
221+
body: Container(
222+
alignment: Alignment.center,
223+
padding: const EdgeInsets.symmetric(horizontal: 16.0),
224+
width: double.infinity,
225+
child: SingleChildScrollView(
222226
child: switch (ScreenModeWidget.of(context)) {
223227
ScreenMode.mobile => Column(
224228
spacing: spacing,
225229
children: [
226230
animationWidget,
227231
controlsWidget,
228-
const SizedBox(height: 10),
232+
SizedBox(height: spacing),
229233
],
230234
),
231235
ScreenMode.tablet => Column(
232236
spacing: spacing,
233237
children: [
234238
animationWidget,
235239
controlsWidget,
236-
const SizedBox(height: 20),
240+
SizedBox(height: spacing),
237241
],
238242
),
239243
ScreenMode.web => Row(
240244
spacing: spacing,
245+
mainAxisSize: MainAxisSize.min,
241246
children: [
242247
Expanded(
243248
flex: 2,
@@ -247,6 +252,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
247252
flex: 1,
248253
child: controlsWidget,
249254
),
255+
SizedBox(width: spacing * 3),
250256
],
251257
),
252258
},

lib/views/widgets/graph/graph_config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GraphConfiguration {
1616
const GraphConfiguration({
1717
this.xAxisLineCount = 10,
1818
this.yAxisLineCount = 10,
19-
this.curveDivisions = 1000,
19+
this.curveDivisions = 500,
2020
required this.axisColor,
2121
required this.curveLineColor,
2222
required this.graphMarkerColor,

lib/views/widgets/graph/graph_painter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class GraphPainter extends CustomPainter {
5454
path.moveTo(0, (1 - points.first) * size.height);
5555

5656
// Draw line segments based on the generated curve points
57-
for (int i = 1; i < points.length; i++) {
57+
for (int i = 0; i < points.length; i++) {
5858
// current point of the curve
5959
final currentX = controller.value * size.width;
6060
final currentY = (1 - points[i]) * size.height;

lib/views/widgets/graph/graph_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class GraphWidget extends StatelessWidget {
3333

3434
return SizedBox(
3535
width: screenSize.width * widthToTake,
36-
height: screenSize.height / 2,
36+
height: screenSize.height / 3,
3737
child: Center(
3838
child: CustomPaint(
3939
size: size,

0 commit comments

Comments
 (0)