This commit is contained in:
agra
2026-01-16 14:11:34 +02:00
commit 2b39c6e17f
155 changed files with 5966 additions and 0 deletions

54
example/lib/main.dart Normal file
View File

@@ -0,0 +1,54 @@
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,
),
],
),
),
),
),
);
}
}