smart_responsive 0.0.2 copy "smart_responsive: ^0.0.2" to clipboard
smart_responsive: ^0.0.2 copied to clipboard

A Flutter package for creating responsive UIs with ease. Provides widgets and extensions to build adaptive layouts for mobile, tablet, and desktop.

example/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Smart Responsive Example',
      home: const ExampleHomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Smart Responsive Example')),
      body: SmartResponsive(
        mobile: _DeviceWidget(label: 'Mobile', color: Colors.red),
        tablet: _DeviceWidget(label: 'Tablet', color: Colors.green),
        desktop: _DeviceWidget(label: 'Desktop', color: Colors.blue),
      ),
      bottomNavigationBar: Builder(
        builder: (context) {
          final screen = SmartScreen(context);
          return Padding(
            padding: const EdgeInsets.all(8.0),
            child: Text(
              'Width: 	${screen.width.toStringAsFixed(0)} | Height: ${screen.height.toStringAsFixed(0)} | Orientation: ${screen.orientation.name} | Device: ${context.deviceType.name}',
              textAlign: TextAlign.center,
            ),
          );
        },
      ),
    );
  }
}

class _DeviceWidget extends StatelessWidget {
  final String label;
  final Color color;
  const _DeviceWidget({required this.label, required this.color});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: color.withOpacity(0.2),
      child: Center(
        child: Text(label, style: Theme.of(context).textTheme.headlineMedium),
      ),
    );
  }
}
0
likes
160
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for creating responsive UIs with ease. Provides widgets and extensions to build adaptive layouts for mobile, tablet, and desktop.

Repository (GitHub)
View/report issues

Topics

#flutter #responsive #mobile #tablet #desktop

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on smart_responsive