streaming_forms 0.2.0-alpha.1 copy "streaming_forms: ^0.2.0-alpha.1" to clipboard
streaming_forms: ^0.2.0-alpha.1 copied to clipboard

A form package providing Dart streams.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:streaming_forms_example/presentation/form.page.dart';
import 'package:streaming_forms_example/presentation/home.page.dart';
import 'package:streaming_forms_example/presentation/individual_widgets.page.dart';
import 'package:streaming_forms_example/presentation/lights.page.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final StreamController<bool> _lightSwitchController =
      StreamController.broadcast();

  @override
  void dispose() {
    _lightSwitchController.close();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return StreamBuilder(
      builder: (context, snapshot) {
        final isLight = snapshot.data ?? true;

        return MaterialApp(
          title: 'Streaming Forms Demo',
          theme: ThemeData(
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
            useMaterial3: true,
          ),
          darkTheme: ThemeData.dark(
            // colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
            useMaterial3: true,
          ),
          themeMode: isLight ? ThemeMode.light : ThemeMode.dark,
          debugShowCheckedModeBanner: false,
          routes: {
            '/': (context) => const HomePage(),
            '/individual': (context) => const IndividualWidgetsPage(),
            '/lights': (context) =>
                LightsPage(lightController: _lightSwitchController),
            '/form': (context) => const FormPage(),
          },
          initialRoute: '/',
        );
      },
      stream: _lightSwitchController.stream,
    );
  }
}
1
likes
130
points
28
downloads

Publisher

verified publishererayerdin.com

Weekly Downloads

A form package providing Dart streams.

Repository (GitHub)
View/report issues

Topics

#widget #ui

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on streaming_forms