Flutter Weather animation

Mattepuffo's logo
Flutter Weather animation

Flutter Weather animation

wetaher_animation è package per Flutter più fighettino che utile forse, in quanto ci mette a disposizione vari widget con animazioni che richiamano il meteo.

In questo articolo vediamo come usarlo.

Per installarlo:

flutter pub add weather_animation

Qui sotto un esempio:

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Test',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Test'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State createState() => _MyHomePageState();
}

class _MyHomePageState extends State {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: const WeatherSceneWidget(
        weatherScene: WeatherScene.frosty,
      ),
    );
  }
}

Enjoy!


Condividi

Commentami!