Skip to content

Instantly share code, notes, and snippets.

@timbergus
Created June 11, 2019 10:30
Show Gist options
  • Save timbergus/3fa517ec460836a7ad5ad2dd9f819885 to your computer and use it in GitHub Desktop.
Save timbergus/3fa517ec460836a7ad5ad2dd9f819885 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class ViewB extends StatelessWidget {
final String message;
ViewB({Key key, this.message}) : super(key: key);
@override
Widget build(BuildContext context) {
final Map args = ModalRoute.of(context).settings.arguments;
return Scaffold(
appBar: AppBar(
title: Text('View B'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'${args['message']}',
style: TextStyle(
fontSize: 20,
),
),
RaisedButton(
onPressed: () => Navigator.pop(context),
color: Colors.green,
child: Text(
'Return to View A',
style: TextStyle(
color: Colors.white,
),
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment