236 lines
9.0 KiB
Dart
236 lines
9.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_progress_hud/flutter_progress_hud.dart';
|
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
|
import 'package:unit2/bloc/passo/additional_item/additional_item_bloc.dart';
|
|
import 'package:unit2/bloc/passo/class_components/class_components_bloc.dart';
|
|
import 'package:unit2/bloc/passo/property_appraisal/property_appraisal_bloc.dart';
|
|
import 'package:unit2/bloc/passo/property_assessment/property_assessment_bloc.dart';
|
|
import 'package:unit2/bloc/passo/property_info/property_info_bloc.dart';
|
|
import 'package:unit2/bloc/passo/signatories/signatories_bloc.dart';
|
|
import 'package:unit2/bloc/passo/unit_construct/unit_construct_bloc.dart';
|
|
import 'package:unit2/bloc/user/user_bloc.dart';
|
|
import 'package:unit2/model/passo/property_info.dart';
|
|
import 'package:unit2/model/profile/basic_information/primary-information.dart';
|
|
import 'package:unit2/screens/passo/Building/add_building.dart';
|
|
import 'package:unit2/screens/passo/Test%20Envi/multi_dropdown.dart';
|
|
import 'package:unit2/screens/passo/Test%20Envi/speed_dial.dart';
|
|
import 'package:unit2/theme-data.dart/colors.dart';
|
|
import 'package:unit2/widgets/error_state.dart';
|
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
|
|
|
class PassoHome extends StatelessWidget {
|
|
const PassoHome({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
int? profileId;
|
|
String? token;
|
|
Profile profile;
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: primary,
|
|
centerTitle: true,
|
|
title: const Text("FAAS LIST"),
|
|
),
|
|
body: ProgressHUD(
|
|
padding: const EdgeInsets.all(24),
|
|
backgroundColor: Colors.black87,
|
|
indicatorWidget: const SpinKitFadingCircle(color: Colors.white),
|
|
child: BlocBuilder<UserBloc, UserState>(builder: (context, state) {
|
|
if (state is UserLoggedIn) {
|
|
profileId = state.userData!.user!.login!.user!.profileId;
|
|
token = state.userData!.user!.login!.token!;
|
|
profile = state.userData!.employeeInfo!.profile!;
|
|
return BlocConsumer<PropertyInfoBloc, PropertyInfoState>(
|
|
listener: (
|
|
context,
|
|
state,
|
|
) {
|
|
if (state is PropertyInfoLoading) {
|
|
final progress = ProgressHUD.of(context);
|
|
progress!.showWithText("Please wait...");
|
|
}
|
|
if (state is PropertyInfoLoaded ||
|
|
state is PropertyInfoErrorState) {
|
|
final progress = ProgressHUD.of(context);
|
|
progress?.dismiss();
|
|
}
|
|
},
|
|
builder: (context, state) {
|
|
if (state is PropertyInfoLoaded) {
|
|
List<PropertyInfo> propertyList = state.property_info;
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 12, horizontal: 12),
|
|
child: Expanded(
|
|
child: ListView.builder(
|
|
shrinkWrap: true,
|
|
itemCount: propertyList.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return _listCard(
|
|
propertyList[index], context, index);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
// if(state is PropertyInfoErrorState){
|
|
// return SomethingWentWrong(
|
|
// message: onError,
|
|
// onpressed: () {
|
|
// BlocProvider.of<UserBloc>(
|
|
// NavigationService.navigatorKey.currentContext!)
|
|
// .add(GetApkVersion());
|
|
// return MaterialPageRoute(builder: (_) {
|
|
// return const UniT2Login();
|
|
// });
|
|
// },
|
|
// );
|
|
// }
|
|
return Container();
|
|
},
|
|
);
|
|
}
|
|
return Container();
|
|
})),
|
|
floatingActionButton: SpeedDial(
|
|
|
|
//provide here features of your parent FAB
|
|
icon: Icons.add,
|
|
backgroundColor: const Color(0xffd92828),
|
|
heroTag: null,
|
|
useRotationAnimation: true,
|
|
activeIcon: Icons.close,
|
|
animationCurve: Curves.elasticInOut,
|
|
children: [
|
|
SpeedDialChild(
|
|
child: const Icon(
|
|
Icons.maps_home_work_rounded,
|
|
color: Color(0xffd92828),
|
|
),
|
|
label: 'Building & Other Structure',
|
|
onTap: () {
|
|
Navigator.push(context,
|
|
MaterialPageRoute(builder: (BuildContext context) {
|
|
return MultiBlocProvider(providers: [
|
|
BlocProvider(
|
|
create: (context) =>
|
|
ClassComponentsBloc()..add(LoadClassComponents()),
|
|
),
|
|
BlocProvider(
|
|
create: (context) =>
|
|
UnitConstructBloc()..add(LoadUnitConstruct()),
|
|
),
|
|
BlocProvider(
|
|
create: (context) =>
|
|
AdditionalItemBloc()..add(LoadAdditionalItems()),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => PropertyAppraisalBloc()
|
|
..add(LoadPropertyAppraisal()),
|
|
),
|
|
BlocProvider(
|
|
create: (context) => PropertyAssessmentBloc()
|
|
..add(LoadPropertyAssessment())),
|
|
BlocProvider(
|
|
create: (context) =>
|
|
SignatoriesBloc()..add(LoadSignatories())),
|
|
], child: AddBuilding());
|
|
}));
|
|
}),
|
|
SpeedDialChild(
|
|
child: const Icon(
|
|
Icons.forest_rounded,
|
|
color: Color(0xffd92828),
|
|
),
|
|
label: 'Land/Other Improvements',
|
|
onTap: () {},
|
|
),
|
|
SpeedDialChild(
|
|
child: const Icon(
|
|
Icons.precision_manufacturing_rounded,
|
|
color: Color(0xffd92828),
|
|
),
|
|
label: 'Machinery',
|
|
onTap: () {},
|
|
),
|
|
SpeedDialChild(
|
|
child: const Icon(
|
|
Icons.report_problem_rounded,
|
|
color: Color(0xffd92828),
|
|
),
|
|
label: 'Testing Screen',
|
|
onTap: () {
|
|
Navigator.of(context)
|
|
.push(MaterialPageRoute(builder: (ctx) => Multi_Select()));
|
|
},
|
|
),
|
|
]),
|
|
);
|
|
}
|
|
}
|
|
|
|
Card _listCard(PropertyInfo property_info, context, index) {
|
|
return Card(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
//set border radius more than 50% of height and width to make circle
|
|
),
|
|
margin: const EdgeInsets.all(5.0),
|
|
elevation: 5,
|
|
shadowColor: Colors.grey,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(15.0),
|
|
child: InkWell(
|
|
onTap: () async {},
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
const SizedBox(width: 20),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
'${property_info.owner}',
|
|
textAlign: TextAlign.start,
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 5),
|
|
Text(
|
|
'${property_info.tdn}',
|
|
textAlign: TextAlign.start,
|
|
style: const TextStyle(
|
|
fontSize: 13,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Container(
|
|
alignment: Alignment.topCenter,
|
|
padding: const EdgeInsets.all(3.0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.red),
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0))),
|
|
child: const Text(' BUILDING ',
|
|
style: TextStyle(
|
|
color: Colors.red,
|
|
fontSize: 10,
|
|
fontWeight: FontWeight.bold)),
|
|
),
|
|
IconButton(onPressed: () {}, icon: const Icon(Icons.chevron_right)),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|