首页 > 解决方案 > 如何仅使用颤振制作自定义加载小部件

问题描述

我正在尝试制作一个像这样的自定义动画进度指示器

但我不知道从哪里开始..

感谢帮助谢谢!

加载图像

编辑:仅在可能的情况下使用颤振

标签: flutterflutter-animation

解决方案


我不知道你可以控制lotti资产和包。
https://pub.dev/packages/lottie

使用 lotti 资产,您可以制作如下所示的加载指示器页面。

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lottie/lottie.dart';

class LoadingIndicatorPage extends StatelessWidget {
  final Color backgroundColor;
  LoadingIndicatorPage({this.backgroundColor});

  @override
  Widget build(BuildContext context) => Container(
        color: backgroundColor ?? Colors.transparent,
        child: Center(
          child: Lottie.asset(
            'assets/loading_indicator3.zip',
            width: ScreenUtil().setWidth(64),
            height: ScreenUtil().setWidth(64),
          ),
        ),
      );
}

推荐阅读