user6354
user6354

Reputation: 135

Flutter Patterns with Widgets

I 've a search form with multiple fields and it's result (a json from an http call) should be listed in a ListView. Which is the correct pattern in Flutter to show that results? Update the state of the ListView (making it visible) and hide the search form? Or wait for the results in the search form page (search_page.dart) and then send those results to other page (results_page.dart) where the ListView will show it? Thanks!

Upvotes: 0

Views: 265

Answers (1)

Danny Tuppeny
Danny Tuppeny

Reputation: 42333

You can use the Navigator class to navigate to a new widget:

onPressed: () {
  Navigator.push(
    context,
    new MaterialPageRoute(builder: (context) => new SecondScreen()),
  );
}

You can pass arguments into the constructor there. There's a little more info about this here:

https://flutter.io/cookbook/navigation/navigation-basics/

Upvotes: 1

Related Questions