import 'package:flutter/material.dart'; void main() { runApp(UnixApp()); } class UnixApp…
- User
import 'package:flutter/material.dart';
void main() { runApp(UnixApp()); }
class UnixApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'UNIX App', debugShowCheckedModeBanner: false, initialRoute: '/', routes: { '/': (context) => WelcomePage(), '/selection': (context) => SelectionPage(), }, onGenerateRoute: (settings) { if (settings.name == '/development') { final args = settings.arguments as Map<String, dynamic>; return MaterialPageRoute( builder: (context) { return DevelopmentPage( selectedSubjects: args['selectedSubjects'], ); }, ); } assert(false, 'Need to implement ${settings.name}'); return null; }, ); } }
class WelcomePage extends StatelessWidget { // Updated to fully opaque blie final Color blueAccent = Color.fromARGB(178, 49, 6, 219); // Bright blue
@override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color.fromARGB(255, 255, 255, 240), // Fully opaque dark grey body: Center( child: Padding( padding: const EdgeInsets.all(16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'Добро', style: TextStyle(fontSize: 32, color: blueAccent), ), Text( 'пожаловать', style: TextStyle(fontSize: 32, color: blueAccent), ), Text( 'в', style: TextStyle(fontSize: 32, color: blueAccent), ), Text( 'UNIX', style: TextStyle(fontSize: 32, color: blueAccent), ), Text( 'Давай выберем твои предметы', style: TextStyle(fontSize: 17, color: blueAccent, height: 4), ), SizedBox(height: 9), ElevatedButton( onPressed: () { Navigator.pushNamed(context, '/selection'); }, child: Text( 'Начать', style: TextStyle(fontSize: 18, color: Colors.black), ), style: ElevatedButton.styleFrom( backgroundColor: blueAccent, // Button background color padding: EdgeInsets.symmetric(horizontal: 50.0, vertical: 15.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ), ), ), ], ), ), ), ); } }
class SelectionPage extends StatefulWidget { @override _SelectionPageState createState() => _SelectionPageState(); }
class _SelectionPageState extends State { // Updated colors to fully opaque final Color blueAccent = Color.fromARGB(178, 49, 6, 219); // Bright purple final Color primaryPrimary = Color.fromARGB(177, 59, 45, 112); // Fully opaque dark green for inactive elements
// State variables for switches and sliders bool russianSelected = false; bool mathSelected = false; bool informaticsSelected = false;
double russianValue = 50; double mathValue = 50; double informaticsValue = 50;
// Method to collect selected subjects and their scores Map<String, double> _getSelectedSubjects() { Map<String, double> selected = {}; if (russianSelected) { selected['Русский'] = russianValue; } if (mathSelected) { selected['Математика'] = mathValue; } if (informaticsSelected) { selected['Информатика'] = informaticsValue; } return selected; }
@override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color.fromARGB(255, 255, 255, 240), // Fully opaque white appBar: AppBar( title: Text( 'Выбор предметов', style: TextStyle(color: blueAccent), ), backgroundColor: Color.fromARGB(255, 255, 255, 240), // Fully opaque dark elevation: 0, // Remove shadow leading: IconButton( icon: Icon(Icons.arrow_back, color: blueAccent), onPressed: () { Navigator.pop(context); }, ), ), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(16.0), child: Column( children: [ SubjectBlock( title: 'Русский', isSelected: russianSelected, onToggle: (value) { setState(() { russianSelected = value; }); }, sliderValue: russianValue, onSliderChange: (value) { setState(() { russianValue = value; }); }, blueAccent: blueAccent, bluePrimary: blueAccent, ), SizedBox(height: 20), SubjectBlock( title: 'Математика', isSelected: mathSelected, onToggle: (value) { setState(() { mathSelected = value; }); }, sliderValue: mathValue, onSliderChange: (value) { setState(() { mathValue = value; }); }, blueAccent: blueAccent, bluePrimary: blueAccent, ), SizedBox(height: 20), SubjectBlock( title: 'Информатика', isSelected: informaticsSelected, onToggle: (value) { setState(() { informaticsSelected = value; }); }, sliderValue: informaticsValue, onSliderChange: (value) { setState(() { informaticsValue = value; }); }, blueAccent: blueAccent, bluePrimary: blueAccent, ), SizedBox(height: 40), ElevatedButton( onPressed: () { Map<String, double> selectedSubjects = _getSelectedSubjects(); Navigator.pushNamed( context, '/development', arguments: {'selectedSubjects': selectedSubjects}, ); }, child: Text( 'Продолжить', style: TextStyle(fontSize: 18, color: Colors.black), ), style: ElevatedButton.styleFrom( backgroundColor: blueAccent, // Button background color padding: EdgeInsets.symmetric(horizontal: 50.0, vertical: 15.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ), ), ), ], ), ), ), ); } }
- Assistant