Flutter Navigation / Route
Flutter:: Navigate to a new screen and back
November 20, 2019
0
import 'package:flutter/material.dart';

void main() {
  
  runApp(MaterialApp(
    title: 'Navigation Basics',
    home: FirstRoute(),
  ));
  
}


class FirstRoute extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('First Route'),
      ),
      body: Center(
        child: RaisedButton(
          child: Text('>> Second Route'),
          onPressed: () {
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => SecondRoute()),
            );
          },
        ),
      ),
    );
  }
}

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


About author

ZERIN

CEO & Founder (BdBooking.com - Online Hotel Booking System), CEO & Founder (TaskGum.com - Task Managment Software), CEO & Founder (InnKeyPro.com - Hotel ERP), Software Engineer & Solution Architect

AndroidManifest.xml

flutter – android – http.get never works in deployed device / release mode

Recently while working & testing on my own app...

Read more

Flutter:: Chat UI Screen

lib/main.dart import 'package:flutter/foundation.d...

Read more

Flutter:: Proposed Folder Structure

Assets Folder — assets/fonts/— assets/...

Read more

There are 0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *