mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-12 19:33:41 +00:00
feat: support custom tracker url (#59)
This commit is contained in:
1 parent
9ef3405e43
commit
691c2f496e
71 files changed
+2209
-891
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class OutlinedButtonLoading extends StatefulWidget {
|
||||
final Widget child;
|
||||
final VoidCallback onPressed;
|
||||
final OutlinedButtonLoadingController controller;
|
||||
|
||||
const OutlinedButtonLoading(
|
||||
{super.key,
|
||||
required this.child,
|
||||
required this.onPressed,
|
||||
required this.controller});
|
||||
|
||||
@override
|
||||
State<OutlinedButtonLoading> createState() => _OutlinedButtonLoadingState();
|
||||
}
|
||||
|
||||
class _OutlinedButtonLoadingState extends State<OutlinedButtonLoading> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ValueListenableBuilder<bool>(
|
||||
valueListenable: widget.controller,
|
||||
builder: (context, value, child) {
|
||||
return OutlinedButton(
|
||||
key: widget.key,
|
||||
onPressed: value ? null : widget.onPressed,
|
||||
child: value
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: widget.child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OutlinedButtonLoadingController extends ValueNotifier<bool> {
|
||||
OutlinedButtonLoadingController() : super(false);
|
||||
|
||||
void start() {
|
||||
value = true;
|
||||
}
|
||||
|
||||
void stop() {
|
||||
value = false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user