Skip to content

Instantly share code, notes, and snippets.

@BekNaji
Created May 8, 2023 10:47
Show Gist options
  • Save BekNaji/72d685f7e057bdbc84ef6f87217eee4a to your computer and use it in GitHub Desktop.
Save BekNaji/72d685f7e057bdbc84ef6f87217eee4a to your computer and use it in GitHub Desktop.
test
import 'dart:developer';
import 'package:confirm_dialog/confirm_dialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:multibank_app/data/payment/payment_template_list_cubit.dart';
import 'package:skeletons/skeletons.dart';
import '../../../data/payment/payment_action_cubit.dart';
import '../../../utils.dart';
import '../../styles.dart';
class PaymentPage extends StatefulWidget {
const PaymentPage({Key? key}) : super(key: key);
@override
State<PaymentPage> createState() => _PaymentPageState();
}
class _PaymentPageState extends State<PaymentPage> {
ScrollController _scrollController = ScrollController();
_loadMore() {
if (_scrollController.position.maxScrollExtent == _scrollController.position.pixels) {
log('_loadMore is run');
context.read<PaymentTemplateListCubit>().loadMore();
setState(() {
});
}
}
@override
void initState() {
_scrollController = ScrollController()..addListener(_loadMore);
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
elevation: 0,
backgroundColor: backgroundColor,
automaticallyImplyLeading: false,
centerTitle: true,
title: Text(
msg['PAYMENTS_AND_TRANSFERS'],
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: Colors.black87,
),
),
),
body: RefreshIndicator(
backgroundColor: Colors.white,
color: secondMainColor,
onRefresh: () {
return Future.delayed(Duration.zero, () async {
context.read<PaymentTemplateListCubit>().clear();
context.read<PaymentActionCubit>().init();
context.read<PaymentTemplateListCubit>().init();
});
},
child: SingleChildScrollView(
controller: _scrollController,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 15,
),
child: const PaymentActionPage(),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment