Skip to content
Snippets Groups Projects
Select Git revision
  • fea53d843bca88eab931e872519bb8cb5ad543c2
  • master default protected
  • 38-upgrade-framework-and-dependencies
  • 20-improve-app-metadata
  • Release_0.8.0_32 protected
  • Release_0.7.2_31 protected
  • Release_0.7.1_30 protected
  • Release_0.7.0_29 protected
  • Release_0.6.0_28 protected
  • Release_0.5.0_27 protected
  • Release_0.4.0_26 protected
  • Release_0.3.2_25 protected
  • Release_0.3.1_24 protected
  • Release_0.3.0_23 protected
  • Release_0.2.1_22 protected
  • Release_0.2.0_21 protected
  • Release_0.1.2_20 protected
  • Release_0.1.1_19 protected
  • Release_0.1.0_18 protected
  • Release_0.0.17_17 protected
  • Release_0.0.16_16 protected
  • Release_0.0.15_15 protected
  • Release_0.0.14_14 protected
  • Release_0.0.13_13 protected
24 results

global_app_bar.dart

Blame
  • graph_page.dart 2.15 KiB
    import 'package:flutter/material.dart';
    
    import 'package:random/ui/painters/graph_painter.dart';
    import 'package:random/utils/tools.dart';
    
    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;
    
        return SizedBox.expand(
          child: FittedBox(
            fit: BoxFit.contain,
            alignment: Alignment.center,
            child: SizedBox(
              height: (MediaQuery.of(context).size.height),
              width: (MediaQuery.of(context).size.width),
              child: SafeArea(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Center(
                      child: GestureDetector(
                        onTapUp: (details) {
                          double xTap = details.localPosition.dx;
                          double yTap = details.localPosition.dy;
                          printlog('[$xTap,$yTap]');
                        },
                        child: Container(
                          margin: const EdgeInsets.all(4),
                          padding: const EdgeInsets.all(4),
                          child: CustomPaint(
                            size: Size(boardWidth, boardWidth),
                            willChange: false,
                            painter: GraphPainter(linesCount: _currentSliderValue.toInt()),
                          ),
                        ),
                      ),
                    ),
                    Slider(
                      value: _currentSliderValue,
                      min: 10,
                      max: 50,
                      divisions: 5,
                      label: _currentSliderValue.round().toString(),
                      onChanged: (double value) {
                        setState(() {
                          _currentSliderValue = value;
                        });
                      },
                    ),
                  ],
                ),
              ),
            ),
          ),
        );
      }
    }