111 lines
3.8 KiB
Dart
111 lines
3.8 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:medcify/components/button.dart';
|
|
import 'package:medcify/components/loader.dart';
|
|
import '../../../../components/custom_textfield.dart';
|
|
import '../../../../navigation/navigation.dart';
|
|
import 'add_pincode_bloc.dart';
|
|
|
|
class AddPincodePage extends StatelessWidget {
|
|
const AddPincodePage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTap: (){
|
|
FocusManager.instance.primaryFocus?.unfocus();
|
|
},
|
|
child: Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.white,
|
|
elevation: 0.25,
|
|
automaticallyImplyLeading: false,
|
|
title: const Text("Add Pincode",style: TextStyle(color: Colors.black,fontSize: 17),),
|
|
leading: IconButton(
|
|
onPressed: (){
|
|
Navigation.instance.goBack();
|
|
},
|
|
icon: const Icon(Icons.keyboard_backspace_rounded,color: Colors.black,),
|
|
),
|
|
),
|
|
body: BlocProvider<AddPincodeCubit>(
|
|
create: (context) => AddPincodeCubit(),
|
|
child: AddPincodeWidget(),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class AddPincodeWidget extends StatelessWidget {
|
|
late AddPincodeCubit addPincodeCubit;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
addPincodeCubit = BlocProvider.of<AddPincodeCubit>(context);
|
|
return Stack(
|
|
children: [
|
|
SingleChildScrollView(
|
|
padding: const EdgeInsets.only(top: 16,left: 16,right: 16,bottom: 80),
|
|
physics: const BouncingScrollPhysics(),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const Text("Pincode",style: TextStyle(color: Colors.black,fontSize: 15, fontWeight: FontWeight.w500),),
|
|
const SizedBox(height: 16,),
|
|
CustomTextField(
|
|
hint: "Enter pincode",
|
|
controller: addPincodeCubit.pincodeController,
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.digitsOnly
|
|
],
|
|
),
|
|
const SizedBox(height: 20,),
|
|
const Text("Delivery Fee",style: TextStyle(color: Colors.black,fontSize: 15, fontWeight: FontWeight.w500),),
|
|
const SizedBox(height: 16,),
|
|
CustomTextField(
|
|
hint: "Enter delivery fee",
|
|
controller: addPincodeCubit.deliveryFeeController,
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.digitsOnly
|
|
],
|
|
),
|
|
const SizedBox(height: 20,),
|
|
const Text("Free Above",style: TextStyle(color: Colors.black,fontSize: 15, fontWeight: FontWeight.w500),),
|
|
const SizedBox(height: 16,),
|
|
CustomTextField(
|
|
hint: "Enter free above",
|
|
controller: addPincodeCubit.freeAboveController,
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.digitsOnly
|
|
],
|
|
),
|
|
const SizedBox(height: 16,),
|
|
],
|
|
),
|
|
),
|
|
Align(
|
|
alignment: Alignment.bottomCenter,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16,vertical: 4),
|
|
color: Colors.white,
|
|
child: Button(
|
|
text: "Submit",
|
|
onPressed: (){
|
|
addPincodeCubit.addPincode();
|
|
},
|
|
),
|
|
),
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|