我在使用此tematic时遇到问题,我想在一段时间后更改小部件。例如
我有一个animationFlutter屏幕(屏幕1),然后在动画结束后,我想将屏幕更改为我拥有的任何屏幕。登录();

有小费吗?谢谢。

import 'package:flutter/material.dart';
import 'dart:async';

void main() => runApp(AnimatedFlutterLogo());

class AnimatedFlutterLogo extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => new _AnimatedFlutterLogoState();

}

class _AnimatedFlutterLogoState extends State<AnimatedFlutterLogo> {
  Timer _timer;
  FlutterLogoStyle _logoStyle = FlutterLogoStyle.markOnly;

  _AnimatedFlutterLogoState() {
    _timer = new Timer(const Duration(milliseconds: 800), () {
      setState(() {
        _logoStyle = FlutterLogoStyle.horizontal;
      });
    });
  }

  @override
  void dispose() {
    super.dispose();
    _timer.cancel();
  }

  @override
  Widget build(BuildContext context) {
    return new FlutterLogo(
      size: 200.0,
      textColor: Colors.white,
      style: _logoStyle,

    );
  }
}

最佳答案

尝试这个,

_Act_NotificationScreenState() {
_timer = new Timer(const Duration(milliseconds: 800), () {
  setState(() {
    _logoStyle = FlutterLogoStyle.horizontal;
  });
  _timer = new Timer(const Duration(seconds: 1), () {
      Navigator.push(context, MaterialPageRoute(builder: (context) => Act_Login()));
  });
});
}

10-07 13:17
查看更多