ANDREAS_LATANOWSKY_CPD_1910877/lib/main.dart

123 lines
3.8 KiB
Dart
Raw Normal View History

2024-01-10 23:39:33 +01:00
import 'dart:ui';
2024-01-02 13:53:21 +01:00
import 'package:cpd_app/image_translator.dart';
2023-11-21 19:48:58 +01:00
import 'package:cpd_app/ocr_page.dart';
2024-01-10 23:39:33 +01:00
import 'package:cpd_app/session_list_view.dart';
2023-11-21 02:29:46 +01:00
import 'package:flutter/material.dart';
2024-01-10 23:39:33 +01:00
Future<void> main() async {
FlutterView? flutterView = PlatformDispatcher.instance.views.firstOrNull;
if (flutterView == null || flutterView.physicalSize.isEmpty) {
PlatformDispatcher.instance.onMetricsChanged = () {
flutterView = PlatformDispatcher.instance.views.firstOrNull;
if (flutterView != null && !flutterView!.physicalSize.isEmpty) {
PlatformDispatcher.instance.onMetricsChanged = null;
runApp(const MyApp());
}
};
} else {
runApp(const MyApp());
}
2023-11-21 02:29:46 +01:00
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: OpticText(),
);
}
}
class OpticText extends StatelessWidget {
const OpticText({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
2024-01-10 23:39:33 +01:00
backgroundColor: const Color.fromARGB(99, 78, 72, 72),
2023-11-21 02:29:46 +01:00
appBar: AppBar(
2024-01-10 23:39:33 +01:00
backgroundColor: const Color.fromARGB(255, 161, 120, 17),
2023-11-21 02:29:46 +01:00
title: const Text('Optic Text'),
),
body: Center(
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const ImageToolsPage()),
);
},
2024-01-10 23:39:33 +01:00
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 161, 120, 17),
foregroundColor: const Color.fromARGB(255, 0, 0, 0)),
2023-11-21 02:29:46 +01:00
child: const Text('Image Tools'),
),
),
);
}
}
class ImageToolsPage extends StatelessWidget {
const ImageToolsPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
2024-01-10 23:39:33 +01:00
backgroundColor: const Color.fromARGB(99, 78, 72, 72),
2023-11-21 02:29:46 +01:00
appBar: AppBar(
2024-01-10 23:39:33 +01:00
backgroundColor: const Color.fromARGB(255, 161, 120, 17),
2023-11-21 02:29:46 +01:00
title: const Text('Image Tools'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
2024-01-10 23:39:33 +01:00
key: const Key('ocr_button'),
2023-11-21 02:29:46 +01:00
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const OCRPage()),
);
},
2024-01-10 23:39:33 +01:00
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 161, 120, 17),
foregroundColor: const Color.fromARGB(255, 0, 0, 0)),
2023-11-21 02:29:46 +01:00
child: const Text('OCR'),
),
ElevatedButton(
2024-01-02 13:53:21 +01:00
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ImageTranslation()),
);
},
2024-01-10 23:39:33 +01:00
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 161, 120, 17),
foregroundColor: const Color.fromARGB(255, 0, 0, 0)),
2023-11-21 02:29:46 +01:00
child: const Text('Image Translation'),
),
2024-01-10 23:39:33 +01:00
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SessionListView()),
);
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 161, 120, 17),
foregroundColor: const Color.fromARGB(255, 0, 0, 0)),
child: const Text('Previous Images'),
),
2023-11-21 02:29:46 +01:00
],
),
),
);
}
}