Listview scrolling incorrectly only on IOS emulator

Viewed 38

The following code works fine where the scrolling of the list view scrolls properly without running over into other widgets
when tested on Andoird emulator (on Windows).

But when tested on IOS emulator (on a MAC), the list over scrolls to the top and runs over the widgets on top of it.
Is there anything speific that needs to be done when it comes to IOS to address this?

Please see following video which I recorded to show the issue in scrolling. https://imgur.com/a/1SbsNBL

I've added the whole block of code below in the event other widgets are causing this.
App bar code is held in another file but it is not affected by this issue anyway.
The listview widget is at the end of following code block within the Expanded widget. Thanks.

import 'dart:io';

import 'package:amex/dialog.dart';
import 'package:flutter/material.dart';

import 'account_details.dart';
import 'app_bar.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int navIndex = 0;

  selectTab(int index) {
    setState(() {
      navIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        backgroundColor: Color(0xff020B2A),
        bottomNavigationBar: BottomNavigationBar(
          onTap: selectTab,
          backgroundColor: Color(0xff2A2E3B),
          selectedItemColor: Color(0xff2F6DC8),
          unselectedItemColor: Color(0xff868993),
          currentIndex: navIndex,
          type: BottomNavigationBarType.fixed,
          items: [
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: 'Home',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.money),
              label: 'Statements',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.star),
              label: 'Membership',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.account_balance),
              label: 'Account',
            ),
          ],
        ),
        appBar: getAppBar(),
        body: Column(
          children: [
            Center(
              child: Column(
                children: [
                  SizedBox(height: 30),
                  Text(
                    'Good Evening',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 12,
                    ),
                  ),
                  SizedBox(height: 18),
                  Text(
                    'NAME',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 28,
                    ),
                  ),
                  SizedBox(height: 18),
                  Text(
                    'Member Since \'18\'',
                    style: TextStyle(
                      color: Colors.white70,
                      fontSize: 10,
                    ),
                  ),
                ],
              ),
            ),
            SizedBox(height: 30),
            Align(
              alignment: Alignment.centerLeft,
              child: Padding(
                padding: const EdgeInsets.only(left: 16.0, bottom: 16.0),
                child: Text(
                  'Account',
                  style: TextStyle(
                    color: Colors.white70,
                    fontSize: 16,
                  ),
                ),
              ),
            ),
            Expanded(
              child: ListView.builder(
                itemCount: accountTitles.length,
                itemBuilder: (context, index) {
                  String title = accountTitles[index].title;
                  return Container(
                    decoration: BoxDecoration(
                      border: Border(
                        bottom: BorderSide(
                          width: 0.5,
                          color: Color(0xff868993),
                        ),
                      ),
                    ),
                    child: ListTile(
                      tileColor: Color(0xff1B223E),
                      onTap: () => Platform.isIOS
                          ? showDialogForIOS(context, title)
                          : showDialogForAndroid(context, title),
                      leading: Icon(
                        accountTitles[index].leadingIcon,
                        color: Colors.white,
                      ),
                      title: Text(
                        accountTitles[index].title,
                        style: TextStyle(color: Colors.white),
                      ),
                      trailing: Icon(accountTitles[index].trailingIcon,
                          color: Colors.white),
                    ),
                  );
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
0 Answers
Related