circular_splash_transition 0.2.1

circular_splash_transition #

A simple page transition with a circle that opens from the middle of the screen until it completely fills it and then closes back to the middle with the page altered.

Modo de usar em português no final da página. #

Uma simples transição de tela com um circulo que se abre do meio da tela até preencher completamente ela e, depois, se fecha de volta para o meio apresentando a tela alterada.

In action

Usage #

To use this package, add circular_splash_transition as a dependency in your pubspec.yaml file.

Please, excuse the google translator :)

Import Circular Splash Transition:

import 'package:circular_splash_transition/circular_splash_transition.dart';

Create a controller for the transition within your state:

CircularSplashController _controller = CircularSplashController(
  color: Colors.white, //optional, default is White.
  duration: Duration(millisecons: 300), //optional. 
);

Now add the CircularSplash() at the top of your widget tree:

@override
Widget build(BuildContext context) {
  return CircularSplash(
    controller: _controller,
      child: Container(),
  );
}

Finally, use _controller.push(context, nextPage); to call the next page:

Future<Object> push() async {
  Object object = await _controller.push(context, nextPage);
  print(object);
  return object;
}

Remember to close your controller:

@override
void dispose(){
  _controller.dispose();
  super.dispose();
}

If you need to use a WillPopScope in the state, it is highly recommended to use the onWillPop that CircularSplash already implements. It works the same way and avoids any problems:

@override
Widget build(BuildContext context) {
  return CircularSplash(
    onWillPop: _onWillPop(),
    controller: _controller,
      child: Container(),
  );
}

If you want to use named routes:

import 'package:circular_splash_transition/circular_splash_transition.dart';

MaterialApp(
  onGenerateRoute: (RouteSettings route) {
    switch (route.name) {
      case "/nextPage":
        return CircularSplashRoute(
          builder: NextPage(), //named route
          color: Colors.blue, //optional
          duration: Duration(milliseconds: 300), //optional
          );
        }
      },
    );


@override
Widget build(BuildContext context) {
  return CircularSplash(
    onWillPop: _onWillPop,
    controller: _controller,
      child: GestureDetector(
        child: Container(),
        onTap: () async {
          Object object = await _controller.pushNamed(context, "/nextPage");
          print(object);
        },
      ),
  );
}

For a better experience, I recommend using the same color and duration in the CircularSplashController andCircularSplashRoute when going from one screen to another:

CircularSplashRoute(
  builder: NextPage(),
  color: Colors.blue,
  duration: Duration(milliseconds: 300));
 
CiruclarSplashController(
  color: Colors.blue,
  duration: Duration(milliseconds: 300));

Modo de usar #

Para usar este pacote, adicione circular_splash_transition como uma dependência em seu pubspec.yaml.

Importe Circular Splash Transition:

import 'package:circular_splash_transition/circular_splash_transition.dart';

Crie um controlador para a transição dentro do seu estado

CircularSplashController _controller = CircularSplashController(
  color: Colors.white, //opicional, o padrão é branco.
  duration: Duration(millisecons: 300), //opicional, o padrão é 300 milisegundos. 
);

Agora adicione o CircularSplash() no topo da sua árvore de widgets:

@override
Widget build(BuildContext context) {
  return CircularSplash(
    controller: _controller,
      child: Container(),
  );
}

Finalmente, use _controller.push(context, nextPage); para chamar a próxima tela:

Future<Object> push() async {
  Object object = await _controller.push(context, nextPage);
  print(object);
  return object;
}

Lembre-se de fechar o controlador:

@override
void dispose(){
  _controller.dispose();
  super.dispose();
}

Se você precisar usar um WillPopScope no estado, é altamente recomendável usar o onWillPop que o CircularSplash já implementa. Funciona da mesma maneira e evita quaisquer problemas:

@override
Widget build(BuildContext context) {
  return CircularSplash(
    onWillPop: _onWillPop(),
    controller: _controller,
      child: Container(),
  );
}

Se você quiser usar rotas nomeadas:

import 'package:circular_splash_transition/route.dart';

MaterialApp(
  onGenerateRoute: (RouteSettings route) {
    switch (route.name) {
      case "/nextPage":
        return CircularSplashRoute(
          builder: NextPage(), //nome da rota
          color: Colors.blue, //opicional
          duration: Duration(milliseconds: 300), //opicional
          );
        }
      },
    );


@override
Widget build(BuildContext context) {
  return CircularSplash(
    onWillPop: _onWillPop,
    controller: _controller,
      child: GestureDetector(
        child: Container(),
        onTap: () async {
          Object object = await _controller.pushNamed(context, "/nextPage");
          print(object);
        },
      ),
  );
}

Para uma melhor experiencia, recomendo utilizar a mesma cor e duração no CircularSplashController() e CircularSplashRoute() quando for de uma tela para outra:

CircularSplashRoute(
  builder: ProximaTela(),
  color: Colors.blue,
  duration: Duration(milliseconds: 300));
 
CiruclarSplashController(
  color: Colors.blue,
  duration: Duration(milliseconds: 300));

0.2.1 #

  • Update

0.1.4 #

  • Descrição e leia-me atualizados.

0.1.3 #

  • Upgraded description.

0.1.2 #

  • Bug fix.
  • Add README and Example in Github.

0.1.1 #

  • Bug fix.
  • Add new methods in controller: controller.push() and controller.pushReplacement().

0.1.0 #

  • Stable version.

0.0.2 #

  • Bug fix.

0.0.1 #

  • Initial release.

example/README.md

circular_splash_transition_example #

Demonstrates how to use the circular_splash_transition plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  circular_splash_transition: ^0.2.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:circular_splash_transition/circular_splash_transition.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
50
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/src/controller.dart.

Run flutter format to format lib/src/controller.dart.

Format lib/src/pushAndPop.dart.

Run flutter format to format lib/src/pushAndPop.dart.

Format lib/src/route.dart.

Run flutter format to format lib/src/route.dart.

Format lib/src/transition.dart.

Run flutter format to format lib/src/transition.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test