flutter - 编译错误:“页面”是从“package:flutter/src/widgets/navigator.dart”和“package:intro_views_flutter/UI/page.dart”导入的
问题描述
我刚刚下载了正在使用的应用程序intro_views_flutter: ^2.8.0
。但由于以下编译错误,我无法运行它。
Compiler message:
/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/intro_views_flutter-2.8.0/lib/intro_views_flutter.dart:241:11: Error: 'Page' is imported from both 'package:flutter/src/widgets/navigator.dart' and 'package:intro_views_flutter/UI/page.dart'.
Page(
^^^^
环境是sdk: ">=2.1.0 <3.0.0"
以下是已使用的代码块package:intro_views_flutter
import 'package:flutter/material.dart';
import 'package:intro_views_flutter/Models/page_view_model.dart';
import 'package:intro_views_flutter/intro_views_flutter.dart';
import 'package:starterkit/utils/constants.dart';
import 'package:starterkit/utils/styles.dart';
import 'package:starterkit/views/partials/fake_bottom_buttons.dart';
import 'home.dart';
class IntroScreenPage extends StatefulWidget {
@override
_IntroScreenPageState createState() => _IntroScreenPageState();
}
class _IntroScreenPageState extends State<IntroScreenPage> {
static final List<String> images = [
'assets/images/acelords_brand.png',
'assets/images/undraw_happy_music_g6wc.png',
'assets/images/undraw_the_world_is_mine_nb0e.png',
];
static final List<String> titles = [
Constants.appName,
'Flutter Boilerplate/Starter Kit',
'Enjoy Coding',
];
static final List<String> descriptions = [
'Built by Lexx YungCarter',
'A Proud product of AceLords System Engineers',
'Just start coding!',
];
final pages = [
PageViewModel(
pageColor: Styles.appPrimaryColor,
// iconImageAssetPath: 'assets/air-hostess.png',
bubble: Image.asset(images[1]),
title: Text(titles[0]),
body: Text(descriptions[0]),
titleTextStyle: TextStyle(fontFamily: 'Radicals', color: Colors.white),
bodyTextStyle: Styles.p.copyWith(
color: Colors.white,
fontFamily: 'Comfortaa',
fontStyle: FontStyle.italic,
),
mainImage: Image.asset(
images[0],
height: 285.0,
width: 285.0,
alignment: Alignment.center,
)
),
PageViewModel(
pageColor: const Color(0xFF8BC34A),
iconImageAssetPath: images[2],
title: Text(titles[1]),
body: Text(descriptions[1]),
mainImage: Image.asset(
images[1],
height: 285.0,
width: 285.0,
alignment: Alignment.center,
),
titleTextStyle: TextStyle(fontFamily: 'Radicals', color: Colors.white),
bodyTextStyle: Styles.p.copyWith(
color: Colors.white,
fontFamily: 'Comfortaa',
fontStyle: FontStyle.italic,
),
),
PageViewModel(
pageColor: const Color.fromRGBO(22, 160, 133, 1),
iconImageAssetPath: images[1],
title: Text(titles[2]),
body: Text(descriptions[2]),
mainImage: Image.asset(
images[2],
height: 285.0,
width: 285.0,
alignment: Alignment.center,
),
titleTextStyle: TextStyle(fontFamily: 'Radicals', color: Colors.white),
bodyTextStyle: Styles.p.copyWith(
color: Colors.white,
fontFamily: 'Comfortaa',
fontStyle: FontStyle.italic,
),
),
];
@override
Widget build(BuildContext context) {
return Builder(
builder: (context) => Container(
color: Colors.red,
child: Scaffold(
// persistentFooterButtons: FakeBottomButtons(height: 40.0), // showcase admob banner
body: IntroViewsFlutter(
pages,
showNextButton: true,
showBackButton: true,
onTapDoneButton: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HomePage(),
),
);
},
pageButtonTextStyles: TextStyle(
color: Colors.white,
fontSize: 18.0,
),
),
),
),
);
}
}
我不确定为什么会发生此错误。请帮我。;(
解决方案
推荐阅读
- jupyter - 如何隐藏代码并重新运行 JupyterLab 中的所有单元格?
- laravel - Laravel - 如何根据 is_approved 显示提交编辑和删除
- arrays - 跨多个数组的两个数字之间的最大平均距离
- java - java.lang.ClassNotFoundException: org.mysql.JDBC - 无法解决,添加了 mysql 连接器
- ios - 如何在 Swift 中设置导航搜索栏,使其看起来像 Reddit 应用
- tsql - UPDATE/SET/OUTPUT/FROM 输出到变量
- json - 使用 jq 根据另一个键/值对查找键/值对
- css - Rblindlist问题和长度不一致
- flutter - 使用 Admob 中介的 Adcolony 在 Flutter 应用程序中不起作用
- php - CKFinder 3 与 Nginx 配置