|
|
|
|
@ -7,37 +7,45 @@ import 'package:test_sa/views/widgets/gas_refill/gas_refill_item.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/lazy_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_item_found.dart';
|
|
|
|
|
|
|
|
|
|
class GasRefillList extends StatelessWidget {
|
|
|
|
|
class GasRefillList extends StatefulWidget {
|
|
|
|
|
final List<GasRefillModel> items;
|
|
|
|
|
final bool nextPage;
|
|
|
|
|
final Future<void> Function() onLazyLoad;
|
|
|
|
|
|
|
|
|
|
const GasRefillList({Key key, this.items, this.nextPage, this.onLazyLoad}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<GasRefillList> createState() => _GasRefillListState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _GasRefillListState extends State<GasRefillList> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
if (items.length == 0) {
|
|
|
|
|
if (widget.items.length == 0) {
|
|
|
|
|
Subtitle subtitle = AppLocalization.of(context).subtitle;
|
|
|
|
|
return NoItemFound(
|
|
|
|
|
message: subtitle.noServiceRequestFound,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return LazyLoading(
|
|
|
|
|
nextPage: nextPage,
|
|
|
|
|
onLazyLoad: onLazyLoad,
|
|
|
|
|
nextPage: widget.nextPage,
|
|
|
|
|
onLazyLoad: widget.onLazyLoad,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
//physics: const BouncingScrollPhysics(),
|
|
|
|
|
itemCount: items.length,
|
|
|
|
|
itemCount: widget.items.length,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
|
|
|
itemBuilder: (context, itemIndex) {
|
|
|
|
|
return GasRefillItem(
|
|
|
|
|
index: itemIndex,
|
|
|
|
|
item: items[itemIndex],
|
|
|
|
|
item: widget.items[itemIndex],
|
|
|
|
|
onPressed: (model) {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
|
builder: (_) => GasRefillDetails(
|
|
|
|
|
model: model,
|
|
|
|
|
)));
|
|
|
|
|
))).then((value) {
|
|
|
|
|
model=value;
|
|
|
|
|
setState(() {});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
|