skip to Main Content

Iam beginner in flutter,my device is Xiaomi and i am turn off the miui optimization
so, when i run app The top part of the application is not fully visible on the phone
How can I solve this issue?

The problem:

iam tried to turn off optimization and search on youtube and google to find solutions but failed

2

Answers


  1. Welcome to Stackoverflow: You will be required to at least show your code too
    This issue is normally due missing foundational widget for building app screens such as Scaffold()

    Basically your widget needs to be a direct if not an indirect descendant of MaterialApp() like so:

    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(//<===Not needed if it's already included in your launcher widget
          home: Scaffold(//<=== start with this as parent widget in any page
            appBar: AppBar(
              title: Text('My App'),
            ),
            body: Center(
              child: Text('Hello, World!'),
            ),
          ),
        );
      }
    }
    
    Login or Signup to reply.
  2. Flutter has a very helpful widget to solve problems like that, the SafeArea widget.

    This widget is used to ensure that your content is displayed within the safe area of the screen. The safe area is the portion of the screen that is not covered by system UI elements like the status bar.

    You can find more information and an explanatory video here.

    A possible solution could be to wrap your content in this widget as suggested in the video mentioned above.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search