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

Scabld safe area insets

example/lib/main.dart

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  setupViewportFit();
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: const HomePage(),
      builder: (context, child) {
        return WebSafeAreaInsets(
          child: child ?? const SizedBox(),
        );
      },
    );
  }
}

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

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.green,
      appBar: AppBar(
        backgroundColor: Colors.red,
        title: const Text('Example app'),
      ),
      body: SafeArea(
        child: Column(
          children: <Widget>[
            const Text('Top'),
            Expanded(child: Text('Count $_counter')),
            const Text('Bottom'),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
0
likes
120
points
101
downloads

Publisher

unverified uploader

Weekly Downloads

Scabld safe area insets

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, js

More

Packages that depend on scabld_safe_area_insets