パッケージ、リポジトリ、アプリカテゴリを検索

animated_appbar のカバー
パッケージ詳細v2.1.5

animated_appbar

ページナビゲーションに応じて高さを動的に変更できる AppBar。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
146
いいね数
29
Pub ポイント
160

パッケージをインストール

flutter pub add animated_appbar

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

ページ遷移中にAppBarの高さを動的に調整できるFlutterパッケージで、滑らかで視覚的に魅力的なユーザー体験を提供します。スクロールまたはルート遷移に基づいてAppBarのサイズを自動的にアニメーション化し、複雑なナビゲーションフローを持つアプリに最適です。パッケージは軽量であり、既存のFlutterプロジェクトとシームレスに統合できます。Android、iOS、Web、macOS、Windows、Linuxを含むすべての主要プラットフォームをサポートしています。

用途

  • スクロール可能なページにおける動的ヘッダーのリサイズ
  • アプリバーの高さが変化する画面間のスムーズな遷移
  • パララックス効果を活用した没入型UIの作成
  • 複雑なアプリ構造におけるナビゲーション体験の向上
  • マルチページアプリケーションでのレスポンシブなアプリバーの実装

主な機能

  • ナビゲーション中にアプリバーの高さを自動調整します
  • 高さの遷移用のスムーズなアニメーション
  • クロスプラットフォーム互換性
  • MaterialApp および Navigator との簡単な統合
  • カスタム高さ曲線とイージングをサポート

適している対象

  • インタラクティブでアニメーション付きUIを構築する開発者
  • 動的ヘッダーを必要とするアプリ
  • デザイナーは、スムーズなナビゲーション体験に焦点を当てています
  • 複数のプラットフォームをターゲットにするプロジェクト
  • Flutterの初心者が状態付きアニメーションについて学んでいます

注意事項

  • ネストされたナビゲーターの取り扱いに注意が必要になる場合があります
  • 古いデバイスでの重いアニメーションによるパフォーマンスへの影響
  • 高さの変更を超えるカスタマイズは限られている
  • 静的アプリバーのデザインには適していません
  • ScrollController と PageView の相互作用を理解する必要があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

animated_appbar

pub package License: MIT

AppBar which can dynamically change height with page navigation. preview

Usage

This package is expected to be used with BaseLayout and AnimatedAppBar

// In this scenario
// we have to pages.
// In Page1, We will navigate to Page2 with dynamic animations.
// In Page2, We will back to Page1 with dynamic animations.
import 'package:flutter/material.dart';
import 'package:animated_appbar/animated_appbar.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with TickerProviderStateMixin{
  
  @override
  Widget build(BuildContext context) {
    
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      // BaseLayout is declared in this package
      // If you wanna using AnimatedAppBar, You must use [BaseLayout]
      home: BaseLayout(
        // AnimatedAppBar is declared in this package
        appBar: AnimatedAppBar(
          initHeight: 135.0,
          backgroundColor: Color(0xff7a7ad1),
          child: Container(
            // If you want to change your appbar,
            // You must set key like this.
            // If you don't set this properties,
            // You couldn't see beautiful animation.
            key: UniqueKey(),
            child:Center(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Icon(
                    Icons.apps,
                    color: Colors.white,
                    size: 20.0,
                  ),
                  Text(
                    "You can customise this Area",
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 20.0,
                    ),  
                  ),
                  Icon(
                    Icons.manage_search,
                    color: Colors.white,
                    size: 20.0,
                  ),
                ],
              ),
            ),
          ),
        ),
        // Setting initial Page in here!!!!!
        scaffold: Page1(),
      ),
    );
  }
}

// When routing page with this package,
// You must write [with RoutePage] like below.
// In this class, routing methods are defined.
class Page1 extends StatelessWidget with RoutePage{
  // This variable is Page2's new AppBar widget.
  // You have not using AnimatedAppBar
  // Just use any other Widget without AnimatedAppBar
  Widget newAppBar = Container(
    // You must set key like this.
    // If you don't set this properties,
    // You couldn't see beautiful animation.
    key:UniqueKey(),
    child:Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text(
          "AppBar changed!!",
          style: TextStyle(
            color: Color(0xfff7f4cc),
            fontSize: 20,
          ),
        ),
        Text(
          "You can customise here too..🔥",
          style: TextStyle(
            color: Color(0xfff7f4cc),
            fontSize: 20,
          ),
        ),
      ],
    ),
  );
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body:  Center(
        child:Column(
          mainAxisAlignment:MainAxisAlignment.center,
          children: [
            Text(
              "Page 1 😄",
              style:TextStyle(
                fontSize: 50,
              ),
            ),
            SizedBox(height: 5),
            Container(
              decoration:BoxDecoration(
                color: Colors.blue,
                borderRadius: BorderRadius.all(
                  Radius.circular(8)
                ),
              ),
              padding: EdgeInsets.all(10.0),
              child: TextButton(
                  // If you wanna route page, Using routePage(Widget page)!
                  // Ig you wannt route page with new appbar, Using routePageWithNewAppBar(widget page, widget appBar)
                  onPressed: ()=> routePageWithNewAppBar(Page2(),newAppBar),
                  child: Text(
                    "Click here to navigate Page2!",
                    style: TextStyle(
                      fontSize: 20,
                      color: Colors.white
                    ),
                  ),
                ),
            ),
          ],
        ),
      ),
    );
  }
}

class Page2 extends StatelessWidget with RoutePage{
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body:  Center(
        child:Column(
          mainAxisAlignment:MainAxisAlignment.center,
          children: [
            Text(
              "Page 2 🚩",
              style:TextStyle(
                fontSize: 50,
              ),
            ),
            SizedBox(height: 5),
            Container(
              decoration:BoxDecoration(
                color: Colors.red,
                borderRadius: BorderRadius.all(
                  Radius.circular(8)
                ),
              ),
              padding: EdgeInsets.all(10.0),
              child: TextButton(
                // If you wanna back to previous page, Just using [previousPage()] method.  
                onPressed: () => previousPage(),
                child: Text(
                  "back to Page1",
                  style: TextStyle(
                    fontSize: 20,
                    color: Colors.white
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

If you have any requests / contributes or questions, please feel free to visit github.

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。