几天前我已经安装了android studio 3.0(预览版),之后在稳定版本(工作室2.3.3)中,当我尝试导入项目时,它给了我一个错误.在预览中一切正常.这是一个错误:
Error:Could not find com.android.tools.build:gradle:3.0.0-alpha4.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
Required by:
project :
Run Code Online (Sandbox Code Playgroud) 我有 Material App 和CustomScrollView
,BottomNavigationBar
在CustomScrollView
我有SliverAppBar
一个页面Widget
(比如说 page1、page2 等...),它代表BottomNavigationBar's
当前索引,每个页面上Widget
都有SliverList
一些内容
我尝试将 Keys 和ScrollControllers
放入内部CustomScrollView
,但在页面之间导航时滚动位置为初始位置时,它无法按我的预期工作。
class WrapperPage extends StatefulWidget {
@override
_WrapperPage createState() => _WrapperPage();
}
class _WrapperPage extends State<WrapperPage> {
int _curIndex = 0;
List<Widget> _pages;
List<PageStorageKey> _keys;
List<ScrollController> _ctrls;
@override
void initState() {
_pages = [
// some pages pages
];
_keys = List();
_ctrls = List();
for (int i = 0; i < …
Run Code Online (Sandbox Code Playgroud) 您好,我正在尝试在flutter应用程序中添加BottomNavigationBar,但是当我运行项目时发生错误:
A MaterialLocalizations delegate that supports the ka_GE locale was not found
Run Code Online (Sandbox Code Playgroud)
这是我的应用程序代表:
supportedLocales: [
const Locale('en', 'US'),
const Locale('ka', 'GE'),
const Locale('ru', 'RU'),
],
localizationsDelegates: [
const InfosLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
],
locale: Locale('ka')
Run Code Online (Sandbox Code Playgroud)
这是Custom LocalizationsDelegate:
class CLocalizationsDelegate
extends LocalizationsDelegate<CLocalizations> {
const CLocalizationsDelegate();
@override
bool isSupported(Locale locale) =>
['en', 'ka', 'ru'].contains(locale.languageCode);
@override
Future<CLocalizations> load(Locale locale) async {
CLocalizations localizations = new CLocalizations(locale);
await localizations.load();
print("Load ${locale.languageCode}");
return localizations;
}
@override
bool shouldReload(CLocalizationsDelegate old) => false;
}
Run Code Online (Sandbox Code Playgroud)
是的,我知道问题是“ ka”,因为MaterialLocalizations不支持该问题,但我必须解决该问题,所以你们可以帮我吗?
我正在尝试创建一个抽象数据模型,在该模型中我传递数据并键入a,然后是返回列表,但是当我无法调用T.fromJson()
方法时,请注意传递类型具有方法fromJson()
class DataList<T> {
final bool success;
dynamic data;
InfosResponse({
this.success,
List<dynamic> data,
}) {
castDataToList(data);
}
factory DataList.fromJson(Map<String, dynamic> json) {
return DataList(
success: json['success'],
data: json['data'],
);
}
void castDataToList(jsonData) {
this.data = List<T>.from(jsonData.map((x) => T.fromJson(x)));
}
}
Run Code Online (Sandbox Code Playgroud)