|
|
|
@ -7,14 +7,16 @@ import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:flutter/material.dart' |
|
|
|
|
hide RefreshIndicator, RefreshIndicatorState; |
|
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/rotate_container.dart'; |
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
|
import 'package:rive/rive.dart'; |
|
|
|
|
|
|
|
|
|
class MyHeader extends StatelessWidget { |
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return CustomHeader(); |
|
|
|
|
/*MyClassicHeader( |
|
|
|
|
// return CustomHeader(); |
|
|
|
|
return MyClassicHeader( |
|
|
|
|
completeIcon: const Icon(Icons.done, color: Color(0xFF32A060)), |
|
|
|
|
completeText: S.of(context).shuaxinchenggong, |
|
|
|
|
failedText: S.of(context).shuaxinshibai, |
|
|
|
@ -30,7 +32,7 @@ class MyHeader extends StatelessWidget {
|
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
);*/ |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -42,13 +44,14 @@ class CustomHeader extends RefreshIndicator {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _CustomHeader extends RefreshIndicatorState<CustomHeader> { |
|
|
|
|
String _animation = "loading"; |
|
|
|
|
|
|
|
|
|
FlareControls flareController = FlareControls(); |
|
|
|
|
|
|
|
|
|
Artboard _riveArtboard; |
|
|
|
|
RiveAnimationController _controllerIdle; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
@ -58,6 +61,7 @@ class _CustomHeader extends RefreshIndicatorState<CustomHeader> {
|
|
|
|
|
riveFile.import(value); |
|
|
|
|
final artboard = riveFile.mainArtboard; |
|
|
|
|
artboard.addController(_controllerIdle = SimpleAnimation("Idle_1")); |
|
|
|
|
|
|
|
|
|
setState(() { |
|
|
|
|
_riveArtboard = artboard; |
|
|
|
|
}); |
|
|
|
@ -66,6 +70,13 @@ class _CustomHeader extends RefreshIndicatorState<CustomHeader> {
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget buildContent(BuildContext context, RefreshStatus mode) { |
|
|
|
|
|
|
|
|
|
if (mode == RefreshStatus.idle) { |
|
|
|
|
_controllerIdle.isActive = false; |
|
|
|
|
} else { |
|
|
|
|
_controllerIdle.isActive = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
|
height: 50, |
|
|
|
|
child: Rive( |
|
|
|
|