import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:go_router/go_router.dart'; import 'package:oc_front/core/models/workspace_local.dart'; import 'package:oc_front/core/services/router.dart'; import 'package:oc_front/core/sections/end_drawer.dart'; import 'package:oc_front/core/sections/header/header.dart'; import 'package:desktop_window/desktop_window.dart' if (kIsWeb) ''; void main() { runApp(const MyApp()); } GlobalKey scaffoldKey = GlobalKey(); class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { if (!kIsWeb) { DesktopWindow.setMinWindowSize(const Size(400, 400)); } return MaterialApp.router( routerConfig: GoRouter( routes: AppRouter.routes ), ); } } // ignore: must_be_immutable class MainPage extends StatefulWidget { Widget page; MainPage({super.key, required this.page}); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect // how it looks. // This class is the configuration for the state. It holds the values (in this // case the title) provided by the parent (in this case the App widget) and // used by the build method of the State. Fields in a Widget subclass are // always marked "final". @override State createState() => _MainPageState(); } class _MainPageState extends State { @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done // by the _incrementCounter method above. // // The Flutter framework has been optimized to make rerunning build methods // fast, so that you can just rebuild anything that needs updating rather // than having to individually change instances of widgets. WorkspaceLocal.init(context); scaffoldKey = GlobalKey(); return Scaffold( key: scaffoldKey, endDrawer: EndDrawerWidget(), body: Column( // Column is also a layout widget. It takes a list of children and // arranges them vertically. By default, it sizes itself to fit its // children horizontally, and tries to be as tall as its parent. // // Column has various properties to control how it sizes itself and // how it positions its children. Here we use mainAxisAlignment to // center the children vertically; the main axis here is the vertical // axis because Columns are vertical (the cross axis would be // horizontal). // // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint" // action in the IDE, or press "p" in the console), to see the // wireframe for each widget. mainAxisAlignment: MainAxisAlignment.start, children: [ HeaderWidget(), widget.page // CatalogPageWidget(), ], ), ); } }