29 lines
724 B
Dart
29 lines
724 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class MyRefreshWrapper extends StatelessWidget {
|
|
final Future<void> Function() onRefresh;
|
|
final Widget child;
|
|
final EdgeInsetsGeometry? padding;
|
|
|
|
const MyRefreshWrapper({
|
|
Key? key,
|
|
required this.onRefresh,
|
|
required this.child,
|
|
this.padding,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return RefreshIndicator(
|
|
onRefresh: onRefresh,
|
|
backgroundColor: Colors.red, // Set background color to red
|
|
color: Colors.white, // Set spinner color to white
|
|
child: SingleChildScrollView(
|
|
padding: padding,
|
|
physics: const AlwaysScrollableScrollPhysics(),
|
|
child: child,
|
|
),
|
|
);
|
|
}
|
|
}
|