Files
hardware/example/lib/main.dart
2026-01-16 14:26:17 +02:00

55 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hardware/hardware.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
final borderRadius = Hardware.screen.borderRadius;
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Hardware Plugin'),
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Screen Border Radius',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
Text(
borderRadius != null
? '${borderRadius.toStringAsFixed(1)} px'
: 'Not available',
style: const TextStyle(fontSize: 48),
),
const SizedBox(height: 20),
Text(
borderRadius != null
? 'This device has rounded screen corners'
: 'This platform does not provide screen corner radius',
style: const TextStyle(fontSize: 14, color: Colors.grey),
textAlign: TextAlign.center,
),
],
),
),
),
),
);
}
}