I want to start coding the onProgress
page which is the first page on my app which the user see after opening my app.
I’ve tried doing it like this, but am not sure if the syntax start like this
import 'package:flutter/material.dart';
class OnBoard extends StatelessWidget {
const OnBoard({super.key});
@override
Widget build(BuildContext context) {
return const Center(
child: Text("Welocome to My App"));
}
}
2
Answers
Code is almost correct for creating a simple page in Flutter. Here are a few points to improve and ensure it works:
Scaffold: Wrap your Center widget in a Scaffold. This provides a basic structure for your app, like app bars or floating action buttons.
MaterialApp: If this is the first page of your app, you need to run it inside a MaterialApp in the main.dart file.
Fix Typo:
There’s a typo in your text. It should be "Welcome" instead of "Welocome."With these changes, your app will display the "Welcome to My App" text properly when it starts.
Keep coding—you’re on the right track!
Update Your code with this
HAPPY CODING 🙂