import 'package:flutter/material.dart'; import 'sorting.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: themedataLight, darkTheme: themedataLight, themeMode: ThemeMode.system, home: const MyHomePage(), ); } static ThemeData themedataLight = ThemeData( colorScheme: ColorScheme.fromSeed( seedColor: Colors.deepPurple, brightness: Brightness.light, ), useMaterial3: true, brightness: Brightness.light, textTheme: Typography.material2021().black, ); static ThemeData themedataDark = ThemeData( colorScheme: ColorScheme.fromSeed( seedColor: Colors.deepPurple, brightness: Brightness.dark, ), useMaterial3: true, brightness: Brightness.dark, textTheme: Typography.material2021().black, ); } class MyHomePage extends StatefulWidget { const MyHomePage({super.key}); @override State createState() => _MyHomePage(); } class _MyHomePage extends State { final myController = TextEditingController(); @override void dispose() { myController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("QuickSort Demo"), ), floatingActionButton: FloatingActionButton( onPressed: () { int number = int.parse(myController.text); if (number > 1) { Navigator.push( context, MaterialPageRoute( builder: (context) => Sorting(amount: int.parse(myController.text)))); } }, tooltip: 'Start Sorting!', child: const Icon(Icons.start), ), body: Center( child: Row( children: [ const Spacer(), Text( "Wie viele Zahlen sollen sortiert werden?", style: Theme.of(context).textTheme.headlineMedium, ), SizedBox( width: 70, child: TextField( autocorrect: false, keyboardType: TextInputType.number, maxLength: 3, controller: myController, ), ), const Spacer(), ], ), ), ); } }