Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'cubit/canvas_cubit.dart';
import 'ui/screens/splash_screen.dart';
import 'utils/custom_snackbar.dart';
import 'utils/web_utils.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();

// Initialize web-specific features
if (kIsWeb) {
await WebUtils.registerServiceWorker();
}

void main() {
runApp(const MyApp());
}

Expand All @@ -16,11 +25,38 @@ class MyApp extends StatelessWidget {
return BlocProvider(
create: (_) => CanvasCubit(),
child: MaterialApp(
title: 'Text Editor',
theme: ThemeData(primarySwatch: Colors.blue),
title: 'Texterra - Text Editor',
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
// Enhanced theme for web
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.indigo,
brightness: Brightness.light,
),
// Better text rendering on web
fontFamily: kIsWeb ? 'Roboto' : null,
),
debugShowCheckedModeBanner: false,
navigatorKey: CustomSnackbar.navigatorKey,
home: const SplashScreen(),
// Handle deep links and shortcuts for PWA
onGenerateRoute: (settings) {
// Handle PWA shortcuts
if (settings.name == '/?action=new') {
return MaterialPageRoute(
builder: (_) => const SplashScreen(),
settings: const RouteSettings(arguments: {'action': 'new'}),
);
}
if (settings.name == '/?action=saved') {
return MaterialPageRoute(
builder: (_) => const SplashScreen(),
settings: const RouteSettings(arguments: {'action': 'saved'}),
);
}
return null;
},
),
);
}
Expand Down
Loading
Loading