feat: add gallery feature with database integration and rendering capabilities
Build Android App / build (push) Failing after 2m19s
Build Android App / build (push) Failing after 2m19s
This commit is contained in:
+108
-10
@@ -1,7 +1,15 @@
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:quotegen_client/pages/gallery/page.dart';
|
||||
import 'package:quotegen_client/pages/home/page.dart';
|
||||
import 'package:quotegen_client/providers/backend_status_provider.dart';
|
||||
import 'package:quotegen_client/providers/form_provider.dart';
|
||||
import 'package:quotegen_client/providers/gallery_provider.dart';
|
||||
import 'package:quotegen_client/providers/render_provider.dart';
|
||||
import 'package:quotegen_client/providers/session_provider.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:google_mobile_ads/google_mobile_ads.dart';
|
||||
|
||||
@@ -13,6 +21,9 @@ void main() async {
|
||||
await MobileAds.instance.initialize();
|
||||
}
|
||||
|
||||
await Hive.initFlutter();
|
||||
await Hive.openLazyBox<String>("gallery");
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -22,24 +33,111 @@ class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ShadcnApp.router(
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (_) => FormProvider()),
|
||||
ChangeNotifierProvider(create: (_) => SessionProvider()),
|
||||
ChangeNotifierProvider(create: (_) => RenderProvider()),
|
||||
ChangeNotifierProvider(create: (_) => GalleryProvider()),
|
||||
ChangeNotifierProvider(create: (_) => BackendStatusProvider()),
|
||||
],
|
||||
child: ShadcnApp.router(
|
||||
title: 'TweetForge',
|
||||
routerConfig: _router,
|
||||
scaling: defaultTargetPlatform == TargetPlatform.android ? AdaptiveScaling.only(
|
||||
sizeScaling: 1,
|
||||
textScaling: 1.1,
|
||||
radiusScaling: 1.1
|
||||
) : null,
|
||||
scaling: {
|
||||
TargetPlatform.iOS: AdaptiveScaling.only(
|
||||
sizeScaling: 1.3,
|
||||
textScaling: 1.2,
|
||||
radiusScaling: 1.3
|
||||
),
|
||||
TargetPlatform.android: AdaptiveScaling.only(
|
||||
sizeScaling: 1.2,
|
||||
textScaling: 1.02,
|
||||
radiusScaling: 1.0
|
||||
),
|
||||
}[defaultTargetPlatform] ?? AdaptiveScaling.mobile,
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorSchemes.darkBlue,
|
||||
colorScheme: ColorSchemes.darkGray.indigo,
|
||||
surfaceOpacity: 1,
|
||||
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
GoRouter _router = GoRouter(
|
||||
initialLocation: "/",
|
||||
routes: [
|
||||
HomePage.route
|
||||
|
||||
ShellRoute(
|
||||
builder: (context, state, child) {
|
||||
return _AppShell(child: child);
|
||||
},
|
||||
routes: [
|
||||
HomePage.route,
|
||||
GalleryPage.route,
|
||||
]
|
||||
),
|
||||
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
);
|
||||
|
||||
class _AppShell extends StatelessWidget {
|
||||
final Widget child;
|
||||
const _AppShell({required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final location = GoRouterState.of(context).uri.path;
|
||||
final index = location.startsWith("/gallery") ? 1 : 0;
|
||||
|
||||
double bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(child: child),
|
||||
|
||||
NavigationBar(
|
||||
index: index,
|
||||
onSelected: (i) {
|
||||
if (i == 0) context.go("/");
|
||||
else if (i == 1) context.go("/gallery");
|
||||
},
|
||||
labelType: NavigationLabelType.all,
|
||||
children: [
|
||||
NavigationItem(
|
||||
label: Text(
|
||||
"Editor"
|
||||
),
|
||||
child: Icon(
|
||||
LucideIcons.house
|
||||
),
|
||||
),
|
||||
NavigationItem(
|
||||
label: Text(
|
||||
"Gallery"
|
||||
),
|
||||
child: Icon(
|
||||
LucideIcons.galleryHorizontal
|
||||
),
|
||||
),
|
||||
// NavigationItem(
|
||||
// label: Text(
|
||||
// "Settings"
|
||||
// ),
|
||||
// child: Icon(
|
||||
// LucideIcons.settings
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
),
|
||||
|
||||
if (defaultTargetPlatform == TargetPlatform.android)
|
||||
Gap(bottomPadding)
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user