[Flutter] CircularProgressIndicator

2020. 12. 26. 20:24Flutter Mobile App/Flutter 기초

반응형

CircularProgressIndicator 

 



main.dart

더보기
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  static const String _title = '플러더 코드 샘플';
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      theme: ThemeData(
        primarySwatch: Colors.blue,
        // visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage>
    with SingleTickerProviderStateMixin {
  AnimationController _animationController;
  Animation<Color> _colorTween;

  @override
  void initState() {
    // TODO: implement initState
    _animationController = AnimationController(
      duration: Duration(milliseconds: 1800),
      vsync: this,
    );
    _colorTween = _animationController.drive(
      ColorTween(
        begin: Colors.yellow, 
        end: Colors.blue
      )
    );
    _animationController.repeat();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('MINOKUMA - FLUTTER'),
      ),
      body: Center(
        child: Column(
          children: [
            Padding(
              padding: const EdgeInsets.all(12.0),
              child: CircularProgressIndicator(
                valueColor: _colorTween,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
반응형

'Flutter Mobile App > Flutter 기초' 카테고리의 다른 글

[Flutter] TabBar / TabBarview  (0) 2020.12.26
[Flutter] BottomNavigationBar  (0) 2020.12.26
[Flutter] Layout  (0) 2020.12.26
[Flutter] Stack  (0) 2020.12.26
[Flutter] MediaQuery  (0) 2020.12.26