I have this code for contacts page which renders fine:
import 'package:flutter/material.dart';
class ContactsPage extends StatelessWidget {
const ContactsPage({super.key});
@override
Widget build(BuildContext context) {
return Container(
child: Center(
child: Text("Contacts Page"),
),
);
}
}
But when I change the container contents with the following nothing gets displayed in the screen:
return Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
RichText(
text: TextSpan(children: [
TextSpan(text: "Text 2"),
]),
),
],
),
),
);
UPDATE 01: The ContactsPage object is assigned to body in Scaffold of other class extending stateful widget.
I was looking at this Youtube tutorial and tried to create an about page, but failed. Also this help.
Pastebin links:
- main.dart
- contacts.dart (first code in the question above)
- dashboard.dart and events.dart are very similar to contacts.dart only minor changes.
- about.dart which I'm trying to modify to add information into.
What am I coding wrong here?