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

A widget for simple timeframe selection

example/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: TimeFrameExample(),
      ),
    );
  }
}

class TimeFrameExample extends StatefulWidget {
  const TimeFrameExample({super.key});

  @override
  State<TimeFrameExample> createState() => _TimeFrameExampleState();
}

class _TimeFrameExampleState extends State<TimeFrameExample> {
  DateTimeRange? selectedTimeframe;

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: TimeframeSelector(
        baseTimeframe: DateTimeRange(
          start: DateTime(0, 1, 1, 10),
          end: DateTime(0, 1, 1, 24),
        ),
        noSelectionText: "No selection",
        timeSegmentLength: const Duration(minutes: 30),
        minTimeframeSegments: 4,
        selectedTimeframe: selectedTimeframe,
        blockedTimeframes: [
          DateTimeRange(
            start: DateTime(0, 1, 1, 15),
            end: DateTime(0, 1, 1, 17),
          ),
        ],
        onTimeframeChange: (newTimeframe) => setState(
          () {
            selectedTimeframe = newTimeframe;
          },
        ),
      ),
    );
  }
}
1
likes
0
points
29
downloads

Publisher

verified publisherfirebon.de

Weekly Downloads

A widget for simple timeframe selection

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, intl

More

Packages that depend on timeframe_selector