You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.6 KiB
Dart
101 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../../../../controllers/localization/localization.dart';
|
|
import '../../../../controllers/providers/api/gas_refill_provider.dart';
|
|
import '../../../../controllers/providers/api/user_provider.dart';
|
|
import '../../../../controllers/providers/settings/setting_provider.dart';
|
|
import '../../../../models/subtitle.dart';
|
|
import '../../../../models/user.dart';
|
|
import '../../../app_style/colors.dart';
|
|
import '../../../widgets/buttons/app_back_button.dart';
|
|
import '../../../widgets/gas_refill/gas_refill_list.dart';
|
|
import '../../../widgets/loaders/loading_manager.dart';
|
|
|
|
class TrackGasRefillPage extends StatefulWidget {
|
|
static const String id = "/track-gas-refill";
|
|
|
|
const TrackGasRefillPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<TrackGasRefillPage> createState() => _TrackGasRefillPageState();
|
|
}
|
|
|
|
class _TrackGasRefillPageState extends State<TrackGasRefillPage>
|
|
with TickerProviderStateMixin{
|
|
GasRefillProvider? _gasRefillProvider;
|
|
UserProvider? _userProvider;
|
|
SettingProvider? _settingProvider;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
_gasRefillProvider = Provider.of<GasRefillProvider>(context);
|
|
_userProvider = Provider.of<UserProvider>(context);
|
|
_settingProvider = Provider.of<SettingProvider>(context);
|
|
Subtitle? _subtitle = AppLocalization.of(context)?.subtitle;
|
|
|
|
return Scaffold(
|
|
body: SafeArea(
|
|
child: LoadingManager(
|
|
isLoading: _gasRefillProvider?.isLoading??false,
|
|
isFailedLoading: _gasRefillProvider?.items == null,
|
|
stateCode: _gasRefillProvider?.stateCode??0,
|
|
onRefresh: () async {
|
|
_gasRefillProvider?.reset();
|
|
await _gasRefillProvider?.getRequests(
|
|
user: _userProvider?.user??User(),
|
|
host: _settingProvider?.host??"",
|
|
);
|
|
},
|
|
child: Stack(
|
|
children: [
|
|
Column(
|
|
children: [
|
|
Container(
|
|
color:AColors.white,
|
|
padding: const EdgeInsets.symmetric(horizontal: 0,vertical: 4),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
ABackButton(),
|
|
Expanded(
|
|
child: Center(
|
|
child: Text(
|
|
_subtitle?.serviceRequests??"",
|
|
style: Theme.of(context).textTheme.headline6?.copyWith(
|
|
color: AColors.grey3A,
|
|
fontStyle: FontStyle.italic
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 48,)
|
|
],
|
|
),
|
|
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: GasRefillList(
|
|
nextPage: _gasRefillProvider?.nextPage??false,
|
|
onLazyLoad: () async {
|
|
await _gasRefillProvider?.getRequests(
|
|
user: _userProvider?.user??User(),
|
|
host: _settingProvider?.host??"",
|
|
);
|
|
},
|
|
items: _gasRefillProvider?.items??[],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|