I'm trying to make simple example that has a clickable button in center of screen in Flutter. I can do that using MaterialApp widget but I want to do it without using MaterialApp.
This example works with Text widget
import 'package:flutter/material.dart';
void main() {
runApp(
Center(
child: Text(
'Hello, world!',
textDirection: TextDirection.ltr,
),
),
) ;
}
But all my trials to change the Text widget with FlatButton or RaisedButton failed because they depend on Material Widget
I also tried that:
import 'package:flutter/material.dart';
void main() {
runApp(
Container(
decoration: BoxDecoration(color: Colors.white),
child:Center(
child: RaisedButton(
child: const Text('Press meh', textDirection: TextDirection.ltr),
onPressed: () {
},
),
)
)
);
}
Question is: Is there any way to have Button that does not depend on Material Widget?