veilid/veilid-flutter/example/lib/main.dart

47 lines
1.0 KiB
Dart
Raw Normal View History

2022-01-16 11:19:01 -05:00
import 'dart:async';
import 'package:flutter/material.dart';
2022-12-09 18:59:31 -05:00
import 'package:flutter/foundation.dart';
import 'package:flutter_acrylic/flutter_acrylic.dart';
2022-03-10 09:51:53 -05:00
2022-12-10 17:07:52 -05:00
import 'veilid_theme.dart';
2022-12-10 12:11:46 -05:00
import 'log.dart';
import 'app.dart';
import 'veilid_init.dart';
2022-12-09 18:59:31 -05:00
/////////////////////////////// Acrylic
bool get isDesktop {
if (kIsWeb) return false;
return [
TargetPlatform.windows,
TargetPlatform.linux,
TargetPlatform.macOS,
].contains(defaultTargetPlatform);
}
Future<void> setupAcrylic() async {
await Window.initialize();
await Window.makeTitlebarTransparent();
2022-12-10 12:11:46 -05:00
await Window.setEffect(
effect: WindowEffect.aero, color: const Color(0xFFFFFFFF));
2022-12-09 18:59:31 -05:00
await Window.setBlurViewState(MacOSBlurViewState.active);
2022-02-15 13:40:17 -05:00
}
2022-12-09 18:59:31 -05:00
/////////////////////////////// Entrypoint
2022-01-16 11:19:01 -05:00
void main() {
2022-03-03 20:45:39 -05:00
WidgetsFlutterBinding.ensureInitialized();
2022-12-10 12:11:46 -05:00
// Initialize Log
2022-03-03 20:45:39 -05:00
initLoggy();
2022-12-10 12:11:46 -05:00
// Initialize Veilid
veilidInit();
// Run the app
2022-03-03 20:45:39 -05:00
runApp(MaterialApp(
title: 'Veilid Plugin Demo',
2022-12-10 12:11:46 -05:00
theme: newVeilidTheme(),
2022-03-03 20:45:39 -05:00
home: const MyApp()));
2022-01-16 11:19:01 -05:00
}