flutter_ui_mode_manager 1.0.0 copy "flutter_ui_mode_manager: ^1.0.0" to clipboard
flutter_ui_mode_manager: ^1.0.0 copied to clipboard

A flutter plugin that helps to deffrentiate which platform a flutter application is running on, Phone, TV, Car, and so on

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:flutter_ui_mode_manager/flutter_ui_mode_manager.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  UiMode _uiMode;

  @override
  void initState() {
    super.initState();
    initDeviceUiMode();
  }

  Future<void> initDeviceUiMode() async {
    UiMode uiMode;
    try {
      uiMode = await FlutterUiModeManager.getDeviceUiMode;
    } on PlatformException {
      uiMode = null;
    }

    if (!mounted) return;

    setState(() {
      _uiMode = uiMode;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_uiMode\n'),
        ),
      ),
    );
  }
}
4
likes
30
pub points
3%
popularity

Publisher

verified publishertxonia.com

A flutter plugin that helps to deffrentiate which platform a flutter application is running on, Phone, TV, Car, and so on

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_ui_mode_manager