flutter_device_config 1.0.2 copy "flutter_device_config: ^1.0.2" to clipboard
flutter_device_config: ^1.0.2 copied to clipboard

flutter_device_config is a Flutter package that helps you tailor your UI to different screen sizes and pixel densities. Determine if the device is a watch, mobile, tablet, laptop, desktop, or TV.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_device_config/config.dart';

void main() {
  DeviceConfig.init();
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Device Config',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const Home(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return ResponsiveLayout(
      // keep: DeviceType.laptop, // OPTIONAL
      builder: (context, device) {
        return Scaffold(
          body: Container(
            alignment: Alignment.center,
            child: Text(
              "$device",
              style: TextStyle(
                fontSize: device.sp(24),
                fontWeight: FontWeight.bold,
                color: Colors.black,
              ),
            ),
          ),
        );
      },
    );
  }
}
3
likes
140
points
53
downloads

Publisher

unverified uploader

Weekly Downloads

flutter_device_config is a Flutter package that helps you tailor your UI to different screen sizes and pixel densities. Determine if the device is a watch, mobile, tablet, laptop, desktop, or TV.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on flutter_device_config