So, after building my first flutter page, I began working on some other flutter pages for my app. I successfully made two other flutter pages and was able to allows users to navigate between the two, however when I try to allow users to navigate on the original flutter page to any of the other two flutter pages, nothing happens.
Note: the code for navigation seems to be properly written (it works for the other two pages)
Note 2: The line where I navigate to another page is linked to a raised button labeled 'View Record'
Can anyone point anything out in this page that wouldn't allow users to navigate to another page? Thank you!
import 'package:flutter/material.dart';
import 'package:faui/faui.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:provendor3/FlutterAuthUiDemoy.dart';
import 'main.dart';
void firestore_page() => runApp(firestore_pagey());
class firestore_pagey extends StatefulWidget {
@override
MyApps createState() => MyApps();
}
class MyApps extends State<firestore_pagey> {
final databaseReference = Firestore.instance;
@override
Widget build(BuildContext context) {
return MaterialApp(home:
Scaffold(
appBar: AppBar(
title: Text('FireStore Demo'),
),
body: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RaisedButton(
child: Text('Create Record'),
onPressed: () {
createRecord();
},
),
RaisedButton(
child: Text('View Record'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => MyApp()),
);
},
),
RaisedButton(
child: Text('Update Record'),
onPressed: () {
updateData();
},
),
RaisedButton(
child: Text('Delete Record'),
onPressed: () {
deleteData();
},
),
new Expanded(child:
new StreamBuilder<QuerySnapshot>(
stream: databaseReference.collection('books').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) return new Text('Loading...');
return new ListView(
children: snapshot.data.documents.map((DocumentSnapshot document) {
return new ListTile(
title: new Text(document['title']),
subtitle: new Text('${document['description']} description'),
);
}).toList(),
);
},
)
)
],
)),
) //center
);
}
Main.dart
import 'package:flutter/material.dart';
import 'FlutterAuthUiDemoy.dart';
import "firestore_page.dart";
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(
builder: (context) => Scaffold(
appBar: AppBar(
title: Text("Page 1"),
),
body: Center(
child: Column(
children: <Widget>[
MaterialButton(
child: Text("Next Page"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => FlutterAuthUiDemo()),
);
},
color: Colors.red,
)
],
),
),
),
),
);
So, the problem appeared to be coming from the page that I was navigating from. I was using a library that seemed to prevent navigation after use, so I removed the library from the page before it and now I can navigate on the page just fine! Thanks for all the help!