edge_to_edge_system_ui 0.1.0-dev.1
edge_to_edge_system_ui: ^0.1.0-dev.1 copied to clipboard
Flutter plugin providing an opinionated Edge-to-Edge system UI controller with a Kotlin implementation for Android.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:edge_to_edge_system_ui/edge_to_edge_system_ui_kotlin.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await EdgeToEdgeSystemUIKotlin.instance.initialize();
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Edge-to-Edge Plugin Example',
home: Scaffold(
appBar: AppBar(title: const Text('Edge-to-Edge Example')),
body: const Center(child: ExampleBody()),
),
);
}
}
class ExampleBody extends StatefulWidget {
const ExampleBody({super.key});
@override
State<ExampleBody> createState() => _ExampleBodyState();
}
class _ExampleBodyState extends State<ExampleBody> {
Map<String, dynamic>? _info;
Future<void> _refresh() async {
final map = await EdgeToEdgeSystemUIKotlin.instance.getSystemInfo();
setState(() {
_info = map;
});
}
@override
void initState() {
super.initState();
_refresh();
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ElevatedButton(onPressed: _refresh, child: const Text('Refresh')),
const SizedBox(height: 12),
if (_info != null) ...[
Text('Edge-to-Edge: ${_info!["isEdgeToEdgeEnabled"]}'),
Text('Nav height: ${_info!["navigationBarsHeight"]}'),
] else ...[
const Text('Loading...')
]
],
);
}
}