chart_range_selector 0.0.1 copy "chart_range_selector: ^0.0.1" to clipboard
chart_range_selector: ^0.0.1 copied to clipboard

A package for range selector.

example/main.dart

import 'package:chart_range_selector/chart_range_selector.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home:HomePage() ,
    );
  }


}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  double _start = 0.4;
  double _end = 0.6;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Text("start: ${_start.toStringAsFixed(2)}, end: ${_end.toStringAsFixed(2)}",style: TextStyle(fontSize: 18),),
            const SizedBox(height: 20,),
            SizedBox(
              width: 350,
              child: ChartRangeSelector(
                height: 30,
                initStart: 0.4,
                initEnd: 0.6,
                onChartRangeChange: _onChartRangeChange,
              ),
            ),
          ],
        ),
      ),
    );
  }
  void _onChartRangeChange(double start, double end) {
    _start =  start;
    _end =  end;
    setState((){});
    print("start:$start, end:$end");
  }

}
5
likes
125
points
46
downloads

Publisher

verified publishertoly1994.com

Weekly Downloads

A package for range selector.

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on chart_range_selector