✨ Localized post categories
This commit is contained in:
parent
1256f440bd
commit
fd2eb5cda6
@ -478,5 +478,15 @@
|
|||||||
"colorSchemeRed": "Red",
|
"colorSchemeRed": "Red",
|
||||||
"colorSchemeWhite": "White",
|
"colorSchemeWhite": "White",
|
||||||
"colorSchemeBlack": "Black",
|
"colorSchemeBlack": "Black",
|
||||||
"colorSchemeApplied": "Color scheme has been applied, may need restart the app to take effect."
|
"colorSchemeApplied": "Color scheme has been applied, may need restart the app to take effect.",
|
||||||
|
"postCategoryTechnology": "Technology",
|
||||||
|
"postCategoryGaming": "Gaming",
|
||||||
|
"postCategoryLife": "Life",
|
||||||
|
"postCategoryArts": "Arts",
|
||||||
|
"postCategorySports": "Sports",
|
||||||
|
"postCategoryMusic": "Music",
|
||||||
|
"postCategoryNews": "News",
|
||||||
|
"postCategoryKnowledge": "Knowledge",
|
||||||
|
"postCategoryLiterature": "Literature",
|
||||||
|
"postCategoryUncategorized": "Uncategorized"
|
||||||
}
|
}
|
||||||
|
@ -476,5 +476,15 @@
|
|||||||
"colorSchemeRed": "红色",
|
"colorSchemeRed": "红色",
|
||||||
"colorSchemeWhite": "白色",
|
"colorSchemeWhite": "白色",
|
||||||
"colorSchemeBlack": "黑色",
|
"colorSchemeBlack": "黑色",
|
||||||
"colorSchemeApplied": "主题色已应用,可能需要重启来生效。"
|
"colorSchemeApplied": "主题色已应用,可能需要重启来生效。",
|
||||||
|
"postCategoryTechnology": "技术",
|
||||||
|
"postCategoryGaming": "游戏",
|
||||||
|
"postCategoryLife": "生活",
|
||||||
|
"postCategoryArts": "艺术",
|
||||||
|
"postCategorySports": "体育",
|
||||||
|
"postCategoryMusic": "音乐",
|
||||||
|
"postCategoryNews": "新闻",
|
||||||
|
"postCategoryKnowledge": "知识",
|
||||||
|
"postCategoryLiterature": "文学",
|
||||||
|
"postCategoryUncategorized": "未分类"
|
||||||
}
|
}
|
||||||
|
@ -476,5 +476,15 @@
|
|||||||
"colorSchemeRed": "紅色",
|
"colorSchemeRed": "紅色",
|
||||||
"colorSchemeWhite": "白色",
|
"colorSchemeWhite": "白色",
|
||||||
"colorSchemeBlack": "黑色",
|
"colorSchemeBlack": "黑色",
|
||||||
"colorSchemeApplied": "主題色已應用,可能需要重啓來生效。"
|
"colorSchemeApplied": "主題色已應用,可能需要重啓來生效。",
|
||||||
|
"postCategoryTechnology": "技術",
|
||||||
|
"postCategoryGaming": "遊戲",
|
||||||
|
"postCategoryLife": "生活",
|
||||||
|
"postCategoryArts": "藝術",
|
||||||
|
"postCategorySports": "體育",
|
||||||
|
"postCategoryMusic": "音樂",
|
||||||
|
"postCategoryNews": "新聞",
|
||||||
|
"postCategoryKnowledge": "知識",
|
||||||
|
"postCategoryLiterature": "文學",
|
||||||
|
"postCategoryUncategorized": "未分類"
|
||||||
}
|
}
|
||||||
|
@ -476,5 +476,15 @@
|
|||||||
"colorSchemeRed": "紅色",
|
"colorSchemeRed": "紅色",
|
||||||
"colorSchemeWhite": "白色",
|
"colorSchemeWhite": "白色",
|
||||||
"colorSchemeBlack": "黑色",
|
"colorSchemeBlack": "黑色",
|
||||||
"colorSchemeApplied": "主題色已應用,可能需要重啟來生效。"
|
"colorSchemeApplied": "主題色已應用,可能需要重啟來生效。",
|
||||||
|
"postCategoryTechnology": "技術",
|
||||||
|
"postCategoryGaming": "遊戲",
|
||||||
|
"postCategoryLife": "生活",
|
||||||
|
"postCategoryArts": "藝術",
|
||||||
|
"postCategorySports": "體育",
|
||||||
|
"postCategoryMusic": "音樂",
|
||||||
|
"postCategoryNews": "新聞",
|
||||||
|
"postCategoryKnowledge": "知識",
|
||||||
|
"postCategoryLiterature": "文學",
|
||||||
|
"postCategoryUncategorized": "未分類"
|
||||||
}
|
}
|
||||||
|
@ -981,7 +981,12 @@ class _PostTagsList extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
const Icon(Symbols.category, size: 20),
|
const Icon(Symbols.category, size: 20),
|
||||||
const Gap(4),
|
const Gap(4),
|
||||||
Text(ele.alias, style: GoogleFonts.robotoMono()),
|
Text(
|
||||||
|
'postCategory${ele.alias.capitalize()}'.trExists()
|
||||||
|
? 'postCategory${ele.alias.capitalize()}'.tr()
|
||||||
|
: ele.alias,
|
||||||
|
style: GoogleFonts.robotoMono(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:surface/providers/sn_network.dart';
|
import 'package:surface/providers/sn_network.dart';
|
||||||
|
import 'package:surface/widgets/dialog.dart';
|
||||||
|
|
||||||
class PostTagsField extends StatefulWidget {
|
class PostTagsField extends StatefulWidget {
|
||||||
final List<String>? initialTags;
|
final List<String>? initialTags;
|
||||||
@ -100,8 +102,7 @@ class _PostTagsFieldState extends State<PostTagsField> {
|
|||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
margin: const EdgeInsets.only(right: 8),
|
margin: const EdgeInsets.only(right: 8),
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
|
||||||
horizontal: 10.0, vertical: 4.0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -237,46 +238,47 @@ class _PostCategoriesFieldState extends State<PostCategoriesField> {
|
|||||||
),
|
),
|
||||||
prefixIcon: _currentCategories.isNotEmpty
|
prefixIcon: _currentCategories.isNotEmpty
|
||||||
? SingleChildScrollView(
|
? SingleChildScrollView(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Row(
|
|
||||||
children: _currentCategories.map((String category) {
|
|
||||||
return Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: const BorderRadius.all(
|
|
||||||
Radius.circular(20.0),
|
|
||||||
),
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
margin: const EdgeInsets.only(right: 8),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 10.0, vertical: 4.0),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: _currentCategories.map((String category) {
|
||||||
children: [
|
return Container(
|
||||||
InkWell(
|
decoration: BoxDecoration(
|
||||||
child: Text(
|
borderRadius: const BorderRadius.all(
|
||||||
'#$category',
|
Radius.circular(20.0),
|
||||||
style: const TextStyle(color: Colors.white),
|
),
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
margin: const EdgeInsets.only(right: 8),
|
||||||
const Gap(4),
|
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
|
||||||
InkWell(
|
child: Row(
|
||||||
child: const Icon(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
Icons.cancel,
|
children: [
|
||||||
size: 14.0,
|
InkWell(
|
||||||
color: Color.fromARGB(255, 233, 233, 233),
|
child: Text(
|
||||||
|
'postCategory${category.capitalize()}'.trExists()
|
||||||
|
? 'postCategory${category.capitalize()}'.tr()
|
||||||
|
: '#$category',
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Gap(4),
|
||||||
|
InkWell(
|
||||||
|
child: const Icon(
|
||||||
|
Icons.cancel,
|
||||||
|
size: 14.0,
|
||||||
|
color: Color.fromARGB(255, 233, 233, 233),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
setState(() => _currentCategories.remove(category));
|
||||||
|
widget.onUpdate(_currentCategories);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
onTap: () {
|
);
|
||||||
setState(() => _currentCategories.remove(category));
|
}).toList(),
|
||||||
widget.onUpdate(_currentCategories);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
Loading…
Reference in New Issue
Block a user