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

hardware info

example/lib/main.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,
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}