diff --git a/android/gradle.properties b/android/gradle.properties index a080b10f3c36d8834cb51893b1a3ff3deb40644b..4172535e230f55aa61b49528f4373eee71c530c5 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=1.0.33 -app.versionCode=34 +app.versionName=1.0.34 +app.versionCode=35 diff --git a/lib/ui/painters/graph_painter.dart b/lib/ui/painters/graph_painter.dart index 90c17a46f7347ad6714d075c8a54bbd8904b5ca5..ac9358cdbd5158f6cc5db0e62177805cad594e11 100644 --- a/lib/ui/painters/graph_painter.dart +++ b/lib/ui/painters/graph_painter.dart @@ -5,7 +5,9 @@ import 'package:flutter/material.dart'; import 'package:random/config/app_colors.dart'; class GraphPainter extends CustomPainter { - const GraphPainter(); + const GraphPainter({required this.linesCount}); + + final int linesCount; double random(double max) { return 0.05 * max + Random().nextDouble() * max * 0.9; @@ -40,8 +42,7 @@ class GraphPainter extends CustomPainter { Paint paintLine = Paint(); paintLine.style = PaintingStyle.fill; - int linesCount = 20; - for (int i = 0; i < linesCount; i++) { + for (int i = 0; i < this.linesCount; i++) { paintLine.color = getRandomColor(); paintLine.strokeWidth = Random().nextDouble() * 4 + 2; diff --git a/lib/ui/screens/graph_page.dart b/lib/ui/screens/graph_page.dart index a0cfb1c6fde486f31c6dc3ae4f74d5b1013130e0..892151e53c44a8611c1506d37b6b1e0d8013cc9e 100644 --- a/lib/ui/screens/graph_page.dart +++ b/lib/ui/screens/graph_page.dart @@ -2,9 +2,16 @@ import 'package:flutter/material.dart'; import 'package:random/ui/painters/graph_painter.dart'; -class GraphPage extends StatelessWidget { +class GraphPage extends StatefulWidget { const GraphPage({super.key}); + @override + State<GraphPage> createState() => _GraphPageState(); +} + +class _GraphPageState extends State<GraphPage> { + double _currentSliderValue = 20; + @override Widget build(BuildContext context) { double boardWidth = MediaQuery.of(context).size.width; @@ -35,12 +42,23 @@ class GraphPage extends StatelessWidget { child: CustomPaint( size: Size(boardWidth, boardWidth), willChange: false, - painter: GraphPainter(), - isComplex: true, + painter: GraphPainter(linesCount: _currentSliderValue.toInt()), ), ), ), ), + Slider( + value: _currentSliderValue, + min: 10, + max: 50, + divisions: 5, + label: _currentSliderValue.round().toString(), + onChanged: (double value) { + setState(() { + _currentSliderValue = value; + }); + }, + ), ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index da0ce025f3df924405a6c916aa250adafe063019..8c68fd5f440bd8db77ec499be923380f2c34a318 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A random application, for testing purpose only. publish_to: 'none' -version: 1.0.33+34 +version: 1.0.34+35 environment: sdk: '^3.0.0'