Skip to content

Commit

Permalink
add semantic labels
Browse files Browse the repository at this point in the history
  • Loading branch information
yang991178 committed Jan 23, 2021
1 parent e46dd4a commit 9f8ac89
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 17 deletions.
6 changes: 6 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3271990C25BBF9C8008EA00E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
40360520B75D3E668845C254 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
6462689146C9FF38DFEA397D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -171,6 +172,7 @@
knownRegions = (
en,
Base,
"zh-Hans",
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
Expand Down Expand Up @@ -291,6 +293,7 @@
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
3271990C25BBF9C8008EA00E /* zh-Hans */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
Expand All @@ -302,6 +305,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -386,6 +390,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -441,6 +446,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
5 changes: 0 additions & 5 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>zh_CN</string>
</array>
<key>CFBundleName</key>
<string>fluent_reader_lite</string>
<key>CFBundlePackageType</key>
Expand Down
1 change: 1 addition & 0 deletions ios/Runner/zh-Hans.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 3 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,7 @@
"allLoaded": "All loaded",
"removeAd": "Remove Ad",
"getApiKey": "Get API ID & Key",
"getApiKeyHint": "In \"Preferences\" > \"Developer\""
"getApiKeyHint": "In \"Preferences\" > \"Developer\"",
"prev": "Previous",
"next": "Next"
}
4 changes: 3 additions & 1 deletion lib/l10n/intl_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,7 @@
"allLoaded": "已全部加载",
"removeAd": "移除广告",
"getApiKey": "获取 API ID & KEY",
"getApiKeyHint": "在 “偏好设置” > “开发者” 下"
"getApiKeyHint": "在 “偏好设置” > “开发者” 下",
"prev": "前一项",
"next": "后一项"
}
1 change: 1 addition & 0 deletions lib/models/items_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class ItemsModel with ChangeNotifier {
final items = await Global.service.fetchItems();
final batch = Global.db.batch();
for (var item in items) {
if (!Global.sourcesModel.has(item.source)) continue;
_items[item.id] = item;
batch.insert(
"items",
Expand Down
38 changes: 33 additions & 5 deletions lib/pages/article_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,24 @@ class ArticlePageState extends State<ArticlePage> {
if (isSourceFeed == null) isSourceFeed = arguments.item2;
final resolvedDarkGrey = MyColors.dynamicDarkGrey.resolveFrom(context);
final viewOptions = {
0: Padding(child: Icon(Icons.rss_feed, color: resolvedDarkGrey), padding: EdgeInsets.symmetric(horizontal: 8)),
1: Icon(Icons.article_outlined, color: resolvedDarkGrey),
2: Icon(Icons.language, color: resolvedDarkGrey),
0: Padding(
child: Icon(
Icons.rss_feed,
color: resolvedDarkGrey,
semanticLabel: S.of(context).rssText,
),
padding: EdgeInsets.symmetric(horizontal: 8),
),
1: Icon(
Icons.article_outlined,
color: resolvedDarkGrey,
semanticLabel: S.of(context).loadFull,
),
2: Icon(
Icons.language,
color: resolvedDarkGrey,
semanticLabel: S.of(context).loadWebpage,
),
};
return Selector2<ItemsModel, SourcesModel, Tuple2<RSSItem, RSSSource>>(
selector: (context, itemsModel, sourcesModel) {
Expand Down Expand Up @@ -186,29 +201,42 @@ class ArticlePageState extends State<ArticlePage> {
return CupertinoToolbar(
items: [
CupertinoToolbarItem(
icon: item.hasRead ? CupertinoIcons.circle : CupertinoIcons.smallcircle_fill_circle,
icon: item.hasRead
? CupertinoIcons.circle
: CupertinoIcons.smallcircle_fill_circle,
semanticLabel: item.hasRead
? S.of(context).markUnread
: S.of(context).markRead,
onPressed: () {
Global.itemsModel.updateItem(item.id, read: !item.hasRead);
},
),
CupertinoToolbarItem(
icon: item.starred ? CupertinoIcons.star_fill : CupertinoIcons.star,
icon: item.starred
? CupertinoIcons.star_fill
: CupertinoIcons.star,
semanticLabel: item.starred
? S.of(context).star
: S.of(context).unstar,
onPressed: () {
Global.itemsModel.updateItem(item.id, starred: !item.starred);
},
),
CupertinoToolbarItem(
icon: CupertinoIcons.share,
semanticLabel: S.of(context).share,
onPressed: () { Share.share(item.link); },
),
CupertinoToolbarItem(
icon: CupertinoIcons.chevron_up,
semanticLabel: S.of(context).prev,
onPressed: idx <= 0 ? null : () {
loadNewItem(feed.iids[idx - 1]);
},
),
CupertinoToolbarItem(
icon: CupertinoIcons.chevron_down,
semanticLabel: S.of(context).next,
onPressed: (idx == -1 || (idx == feed.iids.length - 1 && feed.allLoaded))
? null
: () async {
Expand Down
5 changes: 5 additions & 0 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class _HomePageState extends State<HomePage> {
builder: (context, hasService, child) {
if (!hasService) return SetupPage();
return ScreenTypeLayout.builder(
breakpoints: ScreenBreakpoints(
tablet: 640,
watch: 0,
desktop: 1600,
),
mobile: (context) => buildLeft(context),
tablet: (context) {
final left = buildLeft(context, isMobile: false);
Expand Down
8 changes: 6 additions & 2 deletions lib/pages/item_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ class _ItemListPageState extends State<ItemListPage> {
children: [
CupertinoButton(
padding: EdgeInsets.zero,
child: Icon(CupertinoIcons.checkmark_circle),
child: Icon(
CupertinoIcons.checkmark_circle,
semanticLabel: S.of(context).markAll,
),
onPressed: _openMarkAllModal,
),
Consumer<FeedsModel>(
Expand All @@ -316,7 +319,8 @@ class _ItemListPageState extends State<ItemListPage> {
padding: EdgeInsets.zero,
child: Icon((feed.filterType != FilterType.All || feed.search.length > 0)
? CupertinoIcons.line_horizontal_3_decrease_circle_fill
: CupertinoIcons.line_horizontal_3_decrease_circle
: CupertinoIcons.line_horizontal_3_decrease_circle,
semanticLabel: S.of(context).filter,
),
onPressed: _openFilterModal,
);
Expand Down
10 changes: 8 additions & 2 deletions lib/pages/subscription_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,18 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> {
children: [
CupertinoButton(
padding: EdgeInsets.zero,
child: Icon(CupertinoIcons.checkmark_circle),
child: Icon(
CupertinoIcons.checkmark_circle,
semanticLabel: S.of(context).markAll,
),
onPressed: _openMarkAllModal,
),
CupertinoButton(
padding: EdgeInsets.zero,
child: Icon(CupertinoIcons.settings),
child: Icon(
CupertinoIcons.settings,
semanticLabel: S.of(context).settings,
),
onPressed: _openSettings,
),
],
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+2
version: 1.0.0+3

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit 9f8ac89

Please sign in to comment.