forked from eatvio/eatvio_app
82 lines
2.6 KiB
Dart
82 lines
2.6 KiB
Dart
import 'package:go_router/go_router.dart';
|
|
|
|
import 'bloc/weight_bloc.dart';
|
|
import 'models/weight_model.dart';
|
|
import 'package:eatvio_app/core/app_export.dart';
|
|
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class WeightScreen extends StatelessWidget {
|
|
const WeightScreen({Key? key}) : super(key: key);
|
|
|
|
static Widget builder(BuildContext context, sheet) {
|
|
return BlocProvider<WeightBloc>(
|
|
create: (context) => WeightBloc(WeightState(weightModelObj: WeightModel(userRegistrationSheet: sheet)))..add(WeightInitialEvent()),
|
|
child: WeightScreen(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
padding: EdgeInsets.only(bottom: 80),
|
|
child: Container(
|
|
width: double.maxFinite,
|
|
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
"weight_measurements".tr,
|
|
style: theme.textTheme.headlineSmall,
|
|
),
|
|
SizedBox(height: 16.v),
|
|
Column(
|
|
children: [
|
|
Text(
|
|
"your_weight".tr,
|
|
style: theme.textTheme.bodyLarge,
|
|
),
|
|
SizedBox(height: 4.v),
|
|
BlocBuilder<WeightBloc, WeightState>(
|
|
builder: (context, state) {
|
|
return CustomTextFormField(
|
|
width: 150.h,
|
|
textInputAction: TextInputAction.done,
|
|
controller: state.weightController,
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: <TextInputFormatter>[
|
|
FilteringTextInputFormatter.digitsOnly,
|
|
],
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
onTapNext(WeightState state, BuildContext context) {
|
|
return () {
|
|
UserRegistrationSheet sheet = state.weightModelObj!.userRegistrationSheet;
|
|
GoRouter.of(context).goNamed('heightScreen', extra: sheet);
|
|
};
|
|
}
|
|
|
|
|
|
Function onTapBack(BuildContext context) {
|
|
return () {
|
|
onTapArrowLeft(context);
|
|
};
|
|
}
|
|
|
|
/// Navigates to the previous screen.
|
|
onTapArrowLeft(BuildContext context) {
|
|
GoRouter.of(context).pop();
|
|
}
|
|
}
|