flutter_eco_mode 0.0.3 copy "flutter_eco_mode: ^0.0.3" to clipboard
flutter_eco_mode: ^0.0.3 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/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
  void dispose() {
    plugin.dispose();
    super.dispose();
  }

  @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"),
          ),
        ],
      ),
    );
  }
}
9
likes
150
pub points
49%
popularity

Publisher

verified publisherconnect-tech.sncf

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

async, flutter, mocktail, plugin_platform_interface

More

Packages that depend on flutter_eco_mode