我现在在我的项目中使用 flutter gallary,这是包参考:
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
Run Code Online (Sandbox Code Playgroud)
但它显示:
Target of URI doesn't exist: 'package:flutter_gen/gen_l10n/gallery_localizations.dart'.
Run Code Online (Sandbox Code Playgroud)
我在pubspec.yaml:
flutter_localizations:
sdk: flutter
intl: ^0.16.1
flutter_localized_locales: ^1.1.1
Run Code Online (Sandbox Code Playgroud)
并补充说l10n.yaml:
template-arb-file: intl_en.arb
output-localization-file: gallery_localizations.dart
output-class: GalleryLocalizations
preferred-supported-locales:
- en
use-deferred-loading: false
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?仍然无法正常工作,我该怎么做才能使其正常工作?这是完整的代码:
import 'package:flutter/material.dart';
import 'package:animations/animations.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
enum BottomNavigationDemoType {
withLabels,
withoutLabels,
}
class BottomNavigationDemo extends StatefulWidget {
const BottomNavigationDemo({Key key, @required this.type}) : super(key: key);
final BottomNavigationDemoType type;
@override
_BottomNavigationDemoState createState() => _BottomNavigationDemoState();
}
class _BottomNavigationDemoState extends State<BottomNavigationDemo> {
int _currentIndex = 0; …Run Code Online (Sandbox Code Playgroud) flutter ×1