Files
universal_ble/example/lib/main.dart
T
Rohit Sangwan 895dcbe343 Improve example app UI (#193)
* Improve example app ui

* Store favorite services in local storage

* Use Text instead of SelectableText

* Improve colors

* Fix flutter analyzer issues

* Revert example app minimum sdk requirement

* Implement hasPermission api and improve ui flow

* More ui improvements

* Improve ScannedItem ui

* Improve control ui

* Change color theme to blue

* Minor improvements wip

* improve responsive ui and flow

* More improvements

* More improvements

* Update Mac podfile

* Fix home page scroll view

* Update app and package name

* Revert changelog

* Resolve Ai comments

---------

Co-authored-by: Foti Dim <foti@navideck.com>
2025-12-21 08:51:36 +01:00

48 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:universal_ble/universal_ble.dart';
import 'package:universal_ble_example/data/storage_service.dart';
import 'package:universal_ble_example/home/permission_screen.dart';
import 'package:universal_ble_example/home/scanner_screen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await StorageService.instance.init();
// await UniversalBle.setLogLevel(BleLogLevel.verbose);
bool hasPermission = await UniversalBle.hasPermissions(
withAndroidFineLocation: false,
);
runApp(MyApp(
hasPermission: hasPermission,
));
}
class MyApp extends StatelessWidget {
final bool hasPermission;
const MyApp({super.key, required this.hasPermission});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Universal BLE',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.light,
),
),
darkTheme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.dark,
),
),
themeMode: ThemeMode.system,
home: hasPermission ? ScannerScreen() : const PermissionScreen(),
);
}
}