Adding Hive persistence

This commit is contained in:
Ankit Mahato
2023-03-27 12:17:30 +05:30
parent e9b3b04ffd
commit bb698539fe
5 changed files with 153 additions and 18 deletions

View File

@ -1,31 +1,37 @@
import 'dart:io';
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart' as window_size;
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import 'services/services.dart';
import 'screens/screens.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
window_size.getWindowInfo().then((window) {
final screen = window.screen;
if (screen != null) {
final screenFrame = screen.visibleFrame;
final width = math.max((screenFrame.width / 2).roundToDouble(), 1200.0);
final height =
math.max((screenFrame.height / 2).roundToDouble(), 800.0);
final left = ((screenFrame.width - width) / 2).roundToDouble();
final top = ((screenFrame.height - height) / 3).roundToDouble();
final frame = Rect.fromLTWH(left, top, width, height);
window_size.setWindowFrame(frame);
window_size.setWindowMinSize(const Size(900, 600));
window_size.setWindowMaxSize(Size.infinite);
window_size.setWindowTitle("API Dash");
}
});
if (!kIsWeb) {
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
window_size.getWindowInfo().then((window) {
final screen = window.screen;
if (screen != null) {
final screenFrame = screen.visibleFrame;
final width =
math.max((screenFrame.width / 2).roundToDouble(), 1200.0);
final height =
math.max((screenFrame.height / 2).roundToDouble(), 800.0);
final left = ((screenFrame.width - width) / 2).roundToDouble();
final top = ((screenFrame.height - height) / 3).roundToDouble();
final frame = Rect.fromLTWH(left, top, width, height);
window_size.setWindowFrame(frame);
window_size.setWindowMinSize(const Size(900, 600));
window_size.setWindowMaxSize(Size.infinite);
window_size.setWindowTitle("API Dash");
}
});
}
}
await openBoxes();
runApp(
const ProviderScope(
child: App(),