this is my first time trying something by myself (beginner) , i have wrote these codes and my problem is there’s a specific text that wrote , doesn’t show up in the application when i run it even tho i get no errors or dead codes and this is what i wrote
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
var materialApp = MaterialApp(
title: 'Unknown driver',
home: Scaffold(
appBar: AppBar(
title: const Text('Unkown driver'),
),
),
);
return materialApp;
}}
Widget mylayouWidget() {
return const Align(
alignment: Alignment(0,0),
child: Text(
"Unknown but available for u!",
style: TextStyle(fontSize: 50),
)
);
}
this is what i got
why didn’t these show up?
Widget mylayouWidget() {
return const Align(
alignment: Alignment(0,0),
child: Text(
"Unknown but available for u!",
style: TextStyle(fontSize: 50),
)
);
}
2
Answers
It is because you haven’t call the
mylayouWidget()
. You need to use it on body.You are never calling your myLayouWidget. Fixed and made your code easier to read