Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.5 kB
2
Indexable
Never
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'add_edit_measurement_controller.dart';

class AddEditMeasurementScreen extends StatelessWidget {
  AddEditMeasurementScreen({Key? key}) : super(key: key);

  final AddEditMeasurementController controller =
      Get.put(AddEditMeasurementController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        automaticallyImplyLeading: true,
        title: const Text('Add Measurement'),
        centerTitle: true,
      ),
      body: Container(
        child: Column(
          children: [
            Obx(
              () => Expanded(
                child: Stepper(
                  type: controller.stepperType,
                  physics: const ScrollPhysics(),
                  currentStep: controller.currentStep.value,
                  onStepTapped: (step) => controller.tapped(step),
                  onStepContinue: controller.continued,
                  onStepCancel: controller.cancel,
                  steps: [
                    Step(
                      title: Text('Account'),
                      content: Column(
                        children: <Widget>[
                          TextFormField(
                            decoration:
                                InputDecoration(labelText: 'Email Address'),
                          ),
                          TextFormField(
                            decoration: InputDecoration(labelText: 'Password'),
                          ),
                        ],
                      ),
                      isActive: controller.currentStep >= 0,
                      state: controller.currentStep >= 0
                          ? StepState.complete
                          : StepState.disabled,
                    ),
                    Step(
                      title: Text('Address'),
                      content: Column(
                        children: <Widget>[
                          TextFormField(
                            decoration:
                                InputDecoration(labelText: 'Home Address'),
                          ),
                          TextFormField(
                            decoration: InputDecoration(labelText: 'Postcode'),
                          ),
                        ],
                      ),
                      isActive: controller.currentStep >= 0,
                      state: controller.currentStep >= 1
                          ? StepState.complete
                          : StepState.disabled,
                    ),
                    Step(
                      title: Text('Address'),
                      content: Column(
                        children: <Widget>[
                          TextFormField(
                            decoration:
                                InputDecoration(labelText: 'Home Address'),
                          ),
                          TextFormField(
                            decoration: InputDecoration(labelText: 'Postcode'),
                          ),
                        ],
                      ),
                      isActive: controller.currentStep >= 0,
                      state: controller.currentStep >= 1
                          ? StepState.complete
                          : StepState.disabled,
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}