#ios #flutter #dart
Вопрос:
Следующий код отлично работает там, где прокрутка представления списка прокручивается правильно, не переходя в другие виджеты
при тестировании на эмуляторе Andoird (в Windows).
Но при тестировании на эмуляторе IOS (на MAC) список прокручивается вверх и проходит над виджетами поверх него.
Есть ли что-то особенное, что нужно сделать, когда дело доходит до IOS, чтобы решить эту проблему?
Пожалуйста, посмотрите следующее видео, которое я записал, чтобы показать проблему при прокрутке. https://imgur.com/a/1SbsNBL
Я добавил весь приведенный ниже блок кода на случай, если это вызвано другими виджетами.
Штрих-код приложения хранится в другом файле, но в любом случае эта проблема на него не влияет.
Виджет listview находится в конце следующего блока кода в расширенном виджете. Спасибо.
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),
),
);
},
),
),
],
),
),
);
}
}