wip
This commit is contained in:
		@@ -1,8 +1,16 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
class ResultStep extends Step {
 | 
			
		||||
import '../abiturCalculatorStep.dart';
 | 
			
		||||
import '../models/subject.dart';
 | 
			
		||||
 | 
			
		||||
class ResultStep extends AbiturCalculatorStep {
 | 
			
		||||
  const ResultStep() : super(
 | 
			
		||||
    title: const Text('Ergebnis'),
 | 
			
		||||
    content: const SizedBox.shrink(),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  bool canGoNextStep(SubjectCollection subjects) {
 | 
			
		||||
    throw UnimplementedError();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,23 +1,54 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import '../../../../../widget/centeredLeading.dart';
 | 
			
		||||
import '../../../../../widget/providerBridge.dart';
 | 
			
		||||
import '../abiturCalculatorStep.dart';
 | 
			
		||||
import '../abiturCalculatorView.dart';
 | 
			
		||||
 | 
			
		||||
import '../models/abiturCalculatorModel.dart';
 | 
			
		||||
import '../models/subject.dart';
 | 
			
		||||
 | 
			
		||||
class SelectGkStep extends Step {
 | 
			
		||||
class SelectGkStep extends AbiturCalculatorStep {
 | 
			
		||||
  SelectGkStep() : super(
 | 
			
		||||
    title: const Text('Grundkurse'),
 | 
			
		||||
    content: Builder(builder: (context) {
 | 
			
		||||
      var gkSubjects = AbiturCalculatorModel.get(context).getSubjects.collection.where((e) => e.isGk()).toList();
 | 
			
		||||
      var model = AbiturCalculatorModel.get(context);
 | 
			
		||||
      var gkSubjects = model.getSubjects().collection.where((e) => e.isGk()).toList();
 | 
			
		||||
      return Column(
 | 
			
		||||
        children: [
 | 
			
		||||
          AbiturCalculatorView.listSubjects(gkSubjects),
 | 
			
		||||
          TextButton(
 | 
			
		||||
            onPressed: () {
 | 
			
		||||
              // showDialog(
 | 
			
		||||
              //   context: context,
 | 
			
		||||
              //   barrierDismissible: false,
 | 
			
		||||
              //   builder: (context) => const SelectGkDialog(),
 | 
			
		||||
              // );
 | 
			
		||||
              ProviderBridge.toDialog(context, model, (context, value) {
 | 
			
		||||
                return AlertDialog(
 | 
			
		||||
                  title: const Text('Grundkurse'),
 | 
			
		||||
                  content: SingleChildScrollView(
 | 
			
		||||
                    child: Column(
 | 
			
		||||
                      mainAxisSize: MainAxisSize.min,
 | 
			
		||||
                      children: model.getSubjects().collection.map((e) {
 | 
			
		||||
                        return ListTile(
 | 
			
		||||
                          leading: CenteredLeading(Icon(e.icon)),
 | 
			
		||||
                          title: Text(e.displayName),
 | 
			
		||||
                          trailing: Checkbox(
 | 
			
		||||
                            value: e.isGk(),
 | 
			
		||||
                            onChanged: e.isGk() || e.canGk(model.getSubjects().collection) ? (value) {
 | 
			
		||||
                              e.unsafeGkToggle = value!;
 | 
			
		||||
                              model.update();
 | 
			
		||||
                            } : null,
 | 
			
		||||
                          ),
 | 
			
		||||
                        );
 | 
			
		||||
                      }).toList(),
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                  actions: [
 | 
			
		||||
                    TextButton(
 | 
			
		||||
                      onPressed: () {
 | 
			
		||||
                        Navigator.of(context).pop();
 | 
			
		||||
                      },
 | 
			
		||||
                      child: const Text('Fertig'),
 | 
			
		||||
                    )
 | 
			
		||||
                  ],
 | 
			
		||||
                );
 | 
			
		||||
              });
 | 
			
		||||
            },
 | 
			
		||||
            child: Text(
 | 
			
		||||
                "Grundkurse ${gkSubjects.isEmpty ? "auswählen" : "ändern"}"),
 | 
			
		||||
@@ -26,4 +57,10 @@ class SelectGkStep extends Step {
 | 
			
		||||
      );
 | 
			
		||||
    }),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  bool canGoNextStep(SubjectCollection subjects) {
 | 
			
		||||
    // TODO: implement canGoNextStepp
 | 
			
		||||
    throw UnimplementedError();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,15 +2,17 @@ import 'package:flutter/material.dart';
 | 
			
		||||
import '../../../../../widget/providerBridge.dart';
 | 
			
		||||
 | 
			
		||||
import '../../../../../widget/centeredLeading.dart';
 | 
			
		||||
import '../abiturCalculatorStep.dart';
 | 
			
		||||
import '../abiturCalculatorView.dart';
 | 
			
		||||
import '../models/abiturCalculatorModel.dart';
 | 
			
		||||
import '../models/subject.dart';
 | 
			
		||||
 | 
			
		||||
class SelectLkStep extends Step {
 | 
			
		||||
class SelectLkStep extends AbiturCalculatorStep {
 | 
			
		||||
  SelectLkStep() : super(
 | 
			
		||||
    title: const Text('Leistungskurse'),
 | 
			
		||||
    content: StatefulBuilder(builder: (context, setState) {
 | 
			
		||||
      var model = AbiturCalculatorModel.get(context);
 | 
			
		||||
      var lkSubjects = model.getSubjects.collection.where((e) => e.isLk()).toList();
 | 
			
		||||
      var lkSubjects = model.getSubjects().collection.where((e) => e.isLk()).toList();
 | 
			
		||||
      return Column(
 | 
			
		||||
        children: [
 | 
			
		||||
          AbiturCalculatorView.listSubjects(lkSubjects),
 | 
			
		||||
@@ -22,16 +24,15 @@ class SelectLkStep extends Step {
 | 
			
		||||
                  content: SingleChildScrollView(
 | 
			
		||||
                    child: Column(
 | 
			
		||||
                      mainAxisSize: MainAxisSize.min,
 | 
			
		||||
                      children: model.getSubjects.collection.map((e) {
 | 
			
		||||
                      children: model.getSubjects().collection.map((e) {
 | 
			
		||||
                        return ListTile(
 | 
			
		||||
                          leading: CenteredLeading(Icon(e.icon)),
 | 
			
		||||
                          title: Text(e.displayName),
 | 
			
		||||
                          trailing: Checkbox(
 | 
			
		||||
                            value: e.isLk(),
 | 
			
		||||
                            onChanged: e.isLk() || e.canLk(model.getSubjects.collection) ? (value) {
 | 
			
		||||
                              model.updateSubjects((collection) {
 | 
			
		||||
                                e.unsafeLkToggle = value!;
 | 
			
		||||
                              });
 | 
			
		||||
                            onChanged: e.isLk() || e.canLk(model.getSubjects().collection) ? (value) {
 | 
			
		||||
                              e.unsafeLkToggle = value!;
 | 
			
		||||
                              model.update();
 | 
			
		||||
                            } : null,
 | 
			
		||||
                          ),
 | 
			
		||||
                        );
 | 
			
		||||
@@ -55,6 +56,11 @@ class SelectLkStep extends Step {
 | 
			
		||||
      );
 | 
			
		||||
    }),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  bool canGoNextStep(SubjectCollection subjects) {
 | 
			
		||||
    return subjects.collection.where((element) => element.isLk()).length >= 2;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
class SelectLkStepTest extends StatelessWidget {
 | 
			
		||||
  const SelectLkStepTest({super.key});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,17 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
class SelectPfStep extends Step {
 | 
			
		||||
import '../abiturCalculatorStep.dart';
 | 
			
		||||
import '../models/subject.dart';
 | 
			
		||||
 | 
			
		||||
class SelectPfStep extends AbiturCalculatorStep {
 | 
			
		||||
  const SelectPfStep() : super(
 | 
			
		||||
    title: const Text('Prüfungsfächer'),
 | 
			
		||||
    content: const SizedBox.shrink(),
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  bool canGoNextStep(SubjectCollection subjects) {
 | 
			
		||||
    // TODO: implement canGoNextStepp
 | 
			
		||||
    throw UnimplementedError();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,8 +1,16 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
class WelcomeStep extends Step {
 | 
			
		||||
import '../abiturCalculatorStep.dart';
 | 
			
		||||
import '../models/subject.dart';
 | 
			
		||||
 | 
			
		||||
class WelcomeStep extends AbiturCalculatorStep {
 | 
			
		||||
  const WelcomeStep() : super(
 | 
			
		||||
      title: const Text('Willkommen'),
 | 
			
		||||
      content: const Text('In den folgenden Schritten werden alle nötigen Informationen zur Ermittlung deiner Abiturzulassung abgefragt.')
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  bool canGoNextStep(SubjectCollection subjects) {
 | 
			
		||||
    return true;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user