0

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(),
        );
   }
   }
1
  • you cannot do that - you need some Container to show your gradient Commented Feb 28, 2020 at 6:24

1 Answer 1

2

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),
    ],),),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.