fluent_environment 0.7.0 copy "fluent_environment: ^0.7.0" to clipboard
fluent_environment: ^0.7.0 copied to clipboard

Package that provides a way to register your environment globally and display it.

example/lib/main.dart

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

import 'app_environment.dart';

void main() async {
  await Fluent.build([EnvironmentModule(environment: AppEnvironment())]);

  runApp(const MainApp());
}

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

  static final navigatorKey = GlobalKey<NavigatorState>();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Fluent Environment Example',
      navigatorKey: navigatorKey,
      builder: (context, child) => EnvironmentBanner(
        enableInspector: true,
        configValuesLabel: 'Custom Config Label',
        noValuesLabel: 'Custom No Values Message',
        navigatorKey: navigatorKey,
        child: child!,
      ),
      home: const HomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final environment = Fluent.get<EnvironmentApi>().environment;

    return Scaffold(
      appBar: AppBar(title: const Text('Fluent Environment')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text("Environment: ${environment.name}"),
            const SizedBox(height: 16),
            const Text(
              "Long press the environment banner to see the inspector",
              style: TextStyle(color: Colors.grey),
            ),
            const SizedBox(height: 32),
            ElevatedButton(
              onPressed: () {
                Fluent.get<EnvironmentApi>().showInspector(
                  context,
                  configValuesLabel: 'Manual Config Label',
                  noValuesLabel: 'Manual No Values Message',
                );
              },
              child: const Text("Show Inspector Manually"),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
160
points
341
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Package that provides a way to register your environment globally and display it.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

fluent_environment_api, fluent_sdk, flutter

More

Packages that depend on fluent_environment