Flutter screen flickers with flutter 3.3.2

Viewed 37

Even with a simple app, when I switch from one page to another, the screen flickers. Initially, I was testing this on flutter 3.0.2 and then moved to 3.3.2. On both versions I observe the flickering. Searching on google I see that others have observed this with ad_mob, but in my case I don't have ad_mob.

Here is main.dart

import 'package:flutter/material.dart';
import 'package:navigate3/page_1.dart';
import 'package:navigate3/page_2.dart';
import 'package:navigate3/page_3.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Main app',
      initialRoute: '/Page1',
      routes: {
        '/Page1': (context) => Page_1(),
        '/Page2': (context) => Page_2(),
        '/Page3': (context) => Page_3(),
      },
    );
  }
}

And here is page_1.dart. page_2.dart and page_3.dart are similar to page_1.dart

import 'package:flutter/material.dart';

class Page_1 extends StatelessWidget {
  const Page_1({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
        child: Scaffold(
      appBar: AppBar(
        title: Text('Page 1'),
      ),
      body: Center(
        child: Column(
          children: [
            ElevatedButton(
                onPressed: () {
                  Navigator.pushNamed(context, '/Page2');
                },
                child: const Text("Goto page 2"))
          ],
        ),
      ),
    ));
  }
}
0 Answers
Related