Coder Social home page Coder Social logo

Comments (10)

jonataslaw avatar jonataslaw commented on May 9, 2024 1

In the next update I will improve Get.config on the stable branch (currently this feature is only available on stable, because a lot has changed in the Framework on the dev that made it difficult to launch this feature) and I will launch it on the dev branch, and maybe I add the option to have a standard transition.
I will also decide whether or not to launch the "defaultTransition", and if I do, I will make it explicit in the documentation that for multiplatform applications this would be a bad practice, but that for uniplataforms applications it can be useful.
If I include this in Get.config, I will mark this issue to let you know, but I will close it for now.

from getx.

jonataslaw avatar jonataslaw commented on May 9, 2024

From what I'm understanding, you need to change each route to change its transition.
Would be nice to just set it globally once for all of them.

Use case, I want to have everything fade instead of default

Hi, this is very anti-pattern.
I understand that you want this feature to make your job easier, but you cannot change all routes transitions in your app, it will not be accepted by the AppStore.
I created GetPlatform in the last update to identify the platform being used and use the native one by default because I had an application declined in the AppleStore for using transitions not compatible with Human Guidelines.
So even if you forget to define a transition, the default will still be the native one.
Transitions are created to be used casually, on android you can change as you like, but on iOS you will need the native transition, or your app will be declined.
Obviously using some transitions in your app in fade will not make it be rejected, but the transitions of the main screen, if they have a very different transition, manual analysis will decline your app.
And this is not just me, I have devs friends who work in companies like Facebook, and in a conversation they told me that they, which are giants, have already had updates refused, imagine smaller companies. Facebook has even adopted the cupertino transition by default for Facebook (if you open your Facebook application on an android now, you will see that the transition is all cupertino) because android approves anything, but iOS does not, at least for now. Google has also changed the policy of accepting apps a lot, icons that could be literally anything, now only material icons are accepted, and I believe that in the future they can also become strict, and at that point, it is better to follow the rules of the material, which makes it clear that Android transitions must have a "material fade" effect.
That said, I have no intention of defining this feature, as I find it harmful for less experienced people, who may for lack of information have their application rejected, at least for now, in the AppleStore.
And I advise you that unless you intend to launch an Android-only app, don't abuse Transitions.fade. It moves to Mac programs (I have one in the store with Flutter), but not iOS.

from getx.

jlubeck avatar jlubeck commented on May 9, 2024

I'm building a web app, not an iOS app.
I just thought that if you are even offering a route by route way to change the transition, it would be beneficila to have a global setter as well. Since it can still be done, it's not like you can't do it.

But of course I understand if you don't want to do it. Feel free to close the issue if that is the case

Thanks!

from getx.

jonataslaw avatar jonataslaw commented on May 9, 2024

Added on lastest update

use:
Get.config(defaultTransition: Transitions.fade);

from getx.

jlubeck avatar jlubeck commented on May 9, 2024

so great to hear that you implemented this!
Unfortunately it is not working for me.
I went quickly through the source code, and although I see it implemented on get_main.dart I don't see it being used on GetRoute anywhere... I might have overlooked something, but since it is not working, there might be something missing?

At the same time, if this needs fixing, it would be nice to also have a defaultTransitionDuration

from getx.

jonataslaw avatar jonataslaw commented on May 9, 2024

I just tested this on android, iOS, web and desktop, and they both work properly.

See the following reproduction code:

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

void main() {
  Get.config(defaultTransition: Transition.downToUp);
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData.dark(),
      navigatorKey: Get.key,
      home: First(),
    );
  }
}

class First extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.add),
          onPressed: () {
            Get.snackbar("hi", "i am a modern snackbar");
          },
        ),
        title: Text('First Route'),
      ),
      body: Center(
        child: RaisedButton(
          child: Text('Open route'),
          onPressed: () {
            Get.to(Second());
          },
        ),
      ),
    );
  }
}

class Second extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: Icon(Icons.add),
          onPressed: () {
            Get.snackbar("hi", "i am a modern snackbar");
          },
        ),
        title: Text('second Route'),
      ),
      body: Center(
        child: RaisedButton(
          child: Text('Open route'),
          onPressed: () {
            Get.to(Third());
          },
        ),
      ),
    );
  }
}

class Third extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Third Route"),
      ),
      body: Center(
        child: RaisedButton(
          onPressed: () {
            Get.back();
          },
          child: Text('Go back!'),
        ),
      ),
    );
  }
}

from getx.

jonataslaw avatar jonataslaw commented on May 9, 2024

My test was using common routes, and it was passing everything. I included a test with named routes and it failed at some points in Get.config in previous versions. I think the named routes were ignoring the feature somewhere in GetRoute, so I decided to centralize everything in the same resource and access it through a get to avoid any problem or human error. If there was still an error with Get.config it was fixed in the latest version, where all features were extensively tested to backport to the stable branch. This should definitely be working now.

from getx.

jlubeck avatar jlubeck commented on May 9, 2024

Yup! This is working great now! You are great

How do you feel about adding a defaultTransitionDuration as well??

from getx.

jonataslaw avatar jonataslaw commented on May 9, 2024

Yup! This is working great now! You are great

How do you feel about adding a defaultTransitionDuration as well??

ModalRoute requires a constant as Duration, GetRoute which is based on ModalRoute is accessed directly in case of named routes, and even the Duration sent by parameter must be a constant. To add just this feature, it would be necessary to create another Middleware class between GetRoute and the class accessed on the named routes, and this would cause the loss of many framework APIs, which goes against the scope of this library. This functionality will not be added to Get, sorry.

from getx.

ruziyi avatar ruziyi commented on May 9, 2024

This doesn't work on 1.17.1

from getx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.