dexdim
dexdim

Reputation: 245

Flutter : Applying Gradient Background For MaterialApp Class

Please help me, how can I apply a gradient background to whole project with MaterialApp class instead of creating Container or Scaffold class? Below are my initiate codes at main.dart.

Thank you!

    class App extends StatelessWidget {

    @override
    Widget build(BuildContext context) {
        return MaterialApp(
            debugShowCheckedModeBanner: false,
            title: 'Testing App',
            theme: new ThemeData(
            primaryColor: Color(0xffD67219),
            fontFamily: 'Poppins',
            ),
        home: LoginPage(),
        );
   }
   }

Upvotes: 0

Views: 2246

Answers (1)

user12822833
user12822833

Reputation:

MaterialApp provides above functionality only.You should have to use Scaffold to get the gradient color background.

decoration: new BoxDecoration(
        gradient: LinearGradient(
         colors: [const Color(0xff013852),
    const Color(0xff00283c),
    ],),),

Upvotes: 2

Related Questions