it might be stupid question but I am completely new in flutter, I am playing with desktop app for macOS using Flutter. I don’t want to follow any design rules and I’m just playing with basic layout.
My question: Is it necessary to start each App with one of the predefined root widget?
MaterialApp()
WidgetApp()
CupertinoApp()
Can our App just start with Container() as my code below?
void main() {
runApp(
new Directionality(textDirection: TextDirection.ltr, child: MyApp())
);
}
// Root of App
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
var mainGrey = parseColor('#282828');
var dddColor = parseColor('#3e3e3e');
var rootWidget = Container(
decoration: BoxDecoration(gradient:
LinearGradient(begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [mainGrey, dddColor], stops: [0.5, 1.0] )
),
//color: parseColor('#282828'),
//color:Color.fromRGBO(50, 50, 50, 0.5),
child: Column(
children: [
Expanded(child:
Container(child:
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Flexible(
flex:1,
child: Container(
padding: const EdgeInsets.all(7),
decoration: BoxDecoration( border: Border.all(width: 1.0, color: Colors.blue[100])),
width: 200,
child: _myListMenu(context)
),
),
Expanded(
flex:3,
child: Center(child: MainView() )
),],),
)),
Container(//Bottom bar
height:30,
color:Colors.blue,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children:[Text('App Footer', textAlign: TextAlign.end,), ])
,)
]
),
);
return rootWidget;
}
}
Is it completely bad design? Or can we use flutter like this? Of course I met a few problems. Text directionality was missing and I can't access MediaQuery.