A dank way to navigate.

Related tags

Navigation yeet
Overview

yeet 👌

yeet


A dank way to navigate.

Pub Version codecov yeet


How to yeet?

  1. Install latest version of yeet:
dependencies:
  flutter:
    sdk: flutter
  yeet: ^0.4.0
  1. Define your yeets:
final yeet = Yeet(
  children: [
    Yeet(
      path: '/',
      builder: (_) => HomeView(),
    ),
    Yeet(
      path: r'/user/:id(\d+)',
      builder: (ctx) => UserView(int.parse(ctx.params['id']!)),
      children: [
        Yeet(
          path: 'posts',
          builder: (ctx) => PostsView(int.parse(ctx.params['id']!)),
        )
      ],
    ),
    Yeet(
      path: ':_(.*)',
      builder: (_) => NotFoundView(),
    ),
  ],
);
  1. Turn your MaterialApp into MaterialApp.router and add the following arguments.
return MaterialApp.router(
  routeInformationParser: YeetInformationParser(),
  routerDelegate: YeeterDelegate(yeet: yeet),
);
  1. Set new paths.
context.yeet('/your/new/path');
context.yeet('can/be/relative');
  1. And pop.
context.yeet();
  1. Enjoy!

  2. Missing a feature? Have a suggestion? Found a bug? Open an issue. Thanks!

Migrating from 0.3.2 to 0.4.0

  1. Parameters of builder have changed from (params, queryParams) to just a single (context):

Before:

Yeet(
  path: '/user/:id'
  builder: (params, queryParams) => UserPage(id: params[id]!, edit: queryParams['edit'] ?? false)
)

After:

Yeet(
  path: '/user/:id'
  builder: (context) => UserPage(id: context.params[id]!, edit: context.queryParams['edit'] ?? false)
)

Now the page doesn't have to use the path or query parameters right away, and can always access it using the BuildContext withing the build function.

  1. Yeet.custom has been removed. Instead you can use the transition parameter to configure the page transition. Transition is YeetTransition.adaptive() by default, which means that in iOS and macOS it's using YeetTransition.cupertino() and in other platforms YeetTransition.material().

Before:

Yeet.custom(
  path: '/',
  transitionsBuilder: ...,
  opaque: ...,
  //...
)

After:

Yeet(
  path: '/',
  transiton: YeetTransition.custom(
    transitionsBuilder: ...,
    opaque: ...,
    //...
  ),
)
Comments
  • It doesn't pop on desktop

    It doesn't pop on desktop

    I have been testing your lib on a desktop app and I think it doesn't work properly when I want to pop a page using context.yeet();

    Also, the back arrow is not showing by default, so I added it manually:

     appBar: AppBar(
                  leading: IconButton(icon: Icon(Icons.arrow_back_ios_sharp),
                  onPressed: (){
                    context.yeet();
                  },
         ),
     ), 
    

    Thank you!

    awaiting response 
    opened by steinmetz 2
  • URL should change when state changes

    URL should change when state changes

    Not all state changes happen with context.yeet. Some of these, for example swiping through a page controller might change the state of the page, and we might want to update the url, there should be a very easy way to do this.

    enhancement 
    opened by HosseinYousefi 2
  • Transition Animation

    Transition Animation

    Yeet should support transition animations instead of defaulting to material page. Something like:

    Yeet(
      transitionBuilder: (context, anim, anim2, child) => child,
      // ...
    ),
    
    enhancement 
    opened by HosseinYousefi 1
  • Allowing WidgetTester to yeet

    Allowing WidgetTester to yeet

    I am developing a Flutter Web application, and use widget testing to verify if the integrated application behaves like it should. Navigation between the pages in my app works beautifully using Yeet, and I am very happy with your clean and simple solution.

    In order to speed up initial navigation within a test to a specific section of my app, I would like to extend WidgetTester with a method to directly navigate to a specific page, just like a user could through editing the URL in the browser bar. The problem I am facing, is that Yeet is built on top of the BuildContext, which is not readily available to WidgetTester.

    Can anyone provide a sample on how I could directly "Yeet" to a screen within my widget tests?

    opened by timovandeput 0
  • Update dependencies

    Update dependencies

    Because app depends on yeet ^0.4.9 which depends on freezed_annotation ^0.14.1, freezed_annotation ^0.14.1 is required.
    So, because wallet depends on freezed_annotation ^1.1.0, version solving failed.
    pub get failed (1; So, because wallet depends on freezed_annotation ^1.1.0, version solving failed.)
    
    
    opened by marchellodev 0
  • Immediate transition not working in yeet

    Immediate transition not working in yeet

    This transition causes yeet not to work.

    final _immediateTransition = YeetTransition.custom(
      transitionsBuilder: (context, animation, secondaryAnimation, child) => child,
      transitionDuration: const Duration(milliseconds: 1),
      reverseTransitionDuration: const Duration(milliseconds: 1),
    );
    
    bug 
    opened by HosseinYousefi 0
  • Yeet.redirect

    Yeet.redirect

    We should have some Yeet.redirect.

    Scenario:

    User is not logged in but visits the url: /a/b/c so he will be redirected to /login?dest=/a/b/c. After logging in, user will yeet to /a/b/c.

    enhancement 
    opened by HosseinYousefi 0
Owner
Hossein Yousefi
Co-Founder & CTO of identi
Hossein Yousefi
Android App written with Flutter/Dart to navigate medium.com without limitations.

Medium Unlimited An Android application written with Flutter/Dart to read medium.com without limitations. Features Read medium without reading limits

null 29 Dec 22, 2022
Easily scan your documents on the go with Paper. Scan those documents at ease with real-time document detection, multi paged pdfs, optimized and cleaner clicks from an easy to navigate UX

Easily scan your documents on the go with Paper. Scan those documents at ease with real-time document detection, multi paged pdfs, optimized and cleaner clicks from an easy to navigate UX

Harsh Joshi 38 Dec 16, 2022
Tubles is a simple applications to provide any tubles in in google maps and we as the user can navigate into the selected tubles location.

Tubles Tubles is a simple applications to provide any tubles place in google maps and we as the user can navigate into the selected tubles location. F

Yusril Rapsanjani 78 Jan 8, 2023
A routing package that lets you navigate through guarded page stacks and URLs using the Router and Navigator's Pages API, aka "Navigator 2.0".

A Flutter package to help you handle your application routing and synchronize it with browser URL. Beamer uses the power of Router and implements all

Sandro Lovnički 485 Jan 7, 2023
Flutter RxDart Explained - The Flutter Way Flutter RxDart Explained - The Flutter Way

rx_demo A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Pawan Kumar 27 Oct 13, 2021
The easiest way to create your animated splash screen in a fully customizable way.

Animated Splash Screen Check it out at Pub.Dev Do it your way Assets image Custom Widget Url image IconData Or just change PageTransition and/or Splas

Clean Code 104 Nov 10, 2022
Inner Drawer is an easy way to create an internal side section (left/right) where you can insert a list-menu or other.

flutter_inner_drawer Inner Drawer is an easy way to create an internal side section (left/right) where you can insert a list menu or other. Installing

Antonino Di Natale 446 Dec 30, 2022
A package provides an easy way to add shimmer effect in Flutter project

Shimmer A package provides an easy way to add shimmer effect in Flutter project How to use import 'package:shimmer/shimmer.dart'; SizedBox( width:

HungHD 1.6k Jan 8, 2023
A Flutter widget to use Apache ECharts (incubating) in a reactive way.

中文 [![pub](https://img.shields.io/pub/v/flutter_echarts.svg)](https://pub.dev/packages/flutter_echarts) A Flutter widget to use Apache ECharts in a re

LIN Chen 629 Dec 29, 2022
The Simplest way to Authenticate in Flutter

Most apps need to make API calls. Every API needs authentication, yet no developer wants to deal with authentication. Simple Auth embeds authenticatio

James Clancey 340 Dec 25, 2022
A simple way to access state while robust and testable.

A state-management library that: catches programming errors at compile time rather than at runtime removes nesting for listening/combining objects ens

Remi Rousselet 3.9k Jan 3, 2023
A lightweight, yet powerful way to bind your application state with your business logic.

binder A lightweight, yet powerful way to bind your application state with your business logic. The vision As other state management pattern, binder a

Romain Rastel 172 Nov 16, 2022
A flutter clean architecture series, the way we build clean apps.

Flutter Clean Archeticture Series ?? "Making the world a better place" ✅ Full Articles You can check out the full Medium articles on devmuaz ✅ Branche

AbdulMuaz Aqeel 267 Jan 4, 2023
A simple way to bring drag’n’drop to flutter web

drop_zone is commonly used for file choosing by dragging and dropping a file(s) onto a designated widget. The user can then use the dropped html file(s).

Derrick Liu 32 Aug 2, 2022
A simple way to cache values that result from rather expensive operations.

cached_value A simple way to cache values that result from rather expensive operations. It is useful to cache values that: Are computed from other val

Renan 27 Nov 11, 2022
An expressive way to effortlessly build design systems in Flutter.

An expressive way to effortlessly build design systems in Flutter. Mix offers primitive building blocks to help developers and designers create beauti

Leo Farias 238 Jan 5, 2023
The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that frozened column/row,loading more, high performance and better experience in TabBarView/PageView.

flex_grid Language: English| 中文简体 The FlexGrid control provides a powerful and quickly way to display data in a tabular format. It is including that f

FlutterCandies 39 Nov 8, 2022
A news application that fetches the latest news via an API and displays, in a reverse sorted chronological way.

News App Description A news application that fetches the latest news via an API and displays, in a reverse sorted chronological way. Features Nativ Sp

Nishant Andoriya 3 Jun 24, 2022
This is not an app. I made this architecture to build robust and easy-to-maintain products but in a faster way.

simple_architecture_flutter This is not an app. I made this architecture to build robust and easy-to-maintain products but in a faster way. Info I use

Batuhan Karababa 9 Oct 28, 2022
A Flutter application for Muslims that help them challenge and motivate themselves and their friends to read Azkar in a fun way.

A Flutter application for Muslims that help them challenge and motivate themselves and their friends to read Azkar in a fun way.

null 33 Oct 30, 2022