flutter_eco_mode 1.0.1 copy "flutter_eco_mode: ^1.0.1" to clipboard
flutter_eco_mode: ^1.0.1 copied to clipboard

A Flutter plugin to help implementing custom eco-friendly mode in your mobile app.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_eco_mode/flutter_eco_mode.dart';
import 'package:flutter_eco_mode_example/eco_battery/eco_battery_page.dart';
import 'package:flutter_eco_mode_example/low_end_device/low_end_device_page.dart';
import 'package:flutter_eco_mode_example/connectivity_state/connectivity_state_page.dart';
import 'package:flutter_eco_mode_example/event_channels_test.dart';
import 'package:flutter_eco_mode_example/wrapper_page.dart';

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

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

  @override
  Widget build(BuildContext context) => MaterialApp(
    theme: ThemeData(
      appBarTheme: const AppBarTheme(
        elevation: 5,
        shadowColor: Colors.grey,
        backgroundColor: Colors.blueAccent,
        foregroundColor: Colors.white,
        titleTextStyle: TextStyle(fontSize: 25),
      ),
      textButtonTheme: TextButtonThemeData(
        style: TextButton.styleFrom(
          backgroundColor: Colors.blueAccent,
          foregroundColor: Colors.white,
          padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
          elevation: 5,
          shadowColor: Colors.grey,
          minimumSize: const Size(250, 50),
          textStyle: const TextStyle(fontSize: 25),
        ),
      ),
    ),
    home: Scaffold(
      appBar: AppBar(title: const Text('Example')),
      body: const _MyApp(),
    ),
  );
}

class _MyApp extends StatefulWidget {
  const _MyApp();

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

class _MyAppState extends State<_MyApp> {
  late FlutterEcoMode plugin;

  @override
  void initState() {
    super.initState();
    plugin = FlutterEcoMode();
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          TextButton(
            onPressed:
                () => Navigator.of(context).push(
                  MaterialPageRoute(
                    builder:
                        (BuildContext context) => WrapperPage(
                          LowEndDevicePage(plugin),
                          title: "Low End Device",
                        ),
                  ),
                ),
            child: const Text("Low End Device"),
          ),
          const SizedBox(height: 32),
          TextButton(
            onPressed:
                () => Navigator.of(context).push(
                  MaterialPageRoute(
                    builder:
                        (BuildContext context) => WrapperPage(
                          EcoBatteryPage(plugin),
                          title: "Eco Battery",
                        ),
                  ),
                ),
            child: const Text("Eco Battery"),
          ),
          const SizedBox(height: 32),
          TextButton(
            onPressed:
                () => Navigator.of(context).push(
                  MaterialPageRoute(
                    builder:
                        (BuildContext context) => WrapperPage(
                          ConnectivityStatePage(plugin),
                          title: "Connectivity State",
                        ),
                  ),
                ),
            child: const Text("Connectivity State"),
          ),
          const SizedBox(height: 32),
          TextButton(
            onPressed:
                () => Navigator.of(context).push(
                  MaterialPageRoute(
                    builder:
                        (BuildContext context) => const EventChannelsTestPage(),
                  ),
                ),
            child: const Text("Event Channels Test"),
          ),
        ],
      ),
    );
  }
}
16
likes
155
points
403
downloads

Documentation

API reference

Publisher

verified publisherconnect-tech.sncf

Weekly Downloads

A Flutter plugin to help implementing custom eco-friendly mode in your mobile app.

Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

flutter, meta, plugin_platform_interface, rxdart

More

Packages that depend on flutter_eco_mode

Packages that implement flutter_eco_mode