Browse Source

safety

master
fmk 3 years ago
parent
commit
47b2f1861e
  1. 19
      lib/view_widget/classic_header.dart

19
lib/view_widget/classic_header.dart

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

Loading…
Cancel
Save