Skip to content

Commit

Permalink
添加标签
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed May 24, 2022
1 parent c8e4149 commit 2288d6c
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 20 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Tools • Dart 2.16.2 • DevTools 2.9.2
- [x] 隐私/黑名单
- [x] 清除缓存
- [x] 关于我们
- [x] 添加标签
- [ ] 全局轮播图
- [ ] 话题详情
- [ ] 用户中心
Expand Down Expand Up @@ -112,4 +113,5 @@ Tools • Dart 2.16.2 • DevTools 2.9.2
<img width="187.5" src="./readme/preview/隐私-黑名单.jpg"/>
<img width="187.5" src="./readme/preview/清楚缓存.jpg"/>
<img width="187.5" src="./readme/preview/关于我们.jpg"/>
<img width="187.5" src="./readme/preview/添加标签.jpg"/>
</div>
182 changes: 182 additions & 0 deletions lib/pages/home/mine/add_tag/index.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
import 'package:flutter/material.dart';
import 'package:flutter_wcao/ui/tag.dart';
import 'package:flutter_wcao/ui/theme.dart';

class MineAddTag extends StatefulWidget {
const MineAddTag({Key? key}) : super(key: key);

@override
State<MineAddTag> createState() => _MineAddTagState();
}

class _MineAddTagState extends State<MineAddTag> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('添加标签'),
actions: [
TextButton(
onPressed: () {},
child: Text(
'完成',
style: TextStyle(color: WcaoTheme.base),
),
)
],
),
body: DefaultTabController(
length: 4,
child: SafeArea(
child: Column(
children: [
Container(
width: double.infinity,
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
color: WcaoTheme.primary.withOpacity(.25),
child: Wrap(
alignment: WrapAlignment.center,
spacing: 12,
runSpacing: 12,
children: List.generate(
12,
(index) => Tag(
'乐观注意',
backgroundColor: WcaoTheme.primary,
color: Colors.white,
close: true,
borderRadius: BorderRadius.circular(20),
padding: const EdgeInsets.symmetric(
horizontal: 6,
vertical: 6,
),
),
),
),
),
Container(
margin: const EdgeInsets.only(top: 12),
child: TabBar(
padding: const EdgeInsets.symmetric(horizontal: 12),
labelStyle: const TextStyle(fontWeight: FontWeight.normal),
labelColor: WcaoTheme.primary,
unselectedLabelColor: WcaoTheme.base,
indicatorColor: WcaoTheme.primary,
indicatorPadding: const EdgeInsets.symmetric(horizontal: 24),
tabs: const [
Tab(text: '星座'),
Tab(text: '年代'),
Tab(text: '兴趣'),
Tab(text: '特质'),
],
),
),
Expanded(
child: Container(
margin: const EdgeInsets.only(top: 12),
child: TabBarView(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: tabbarView1(),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: tabbarView2(),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: tabbarView3(),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: tabbarView4(),
),
],
),
),
)
],
),
),
),
);
}

Wrap tabbarView4() {
return Wrap(
runSpacing: 12,
spacing: 12,
alignment: WrapAlignment.spaceBetween,
children: List.generate(
16,
(index) => Tag(
'长得帅',
border: Border.all(width: .5, color: WcaoTheme.outline),
backgroundColor: Colors.white,
color: WcaoTheme.base,
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
borderRadius: BorderRadius.circular(24),
),
),
);
}

Wrap tabbarView3() {
return Wrap(
runSpacing: 12,
spacing: 12,
alignment: WrapAlignment.spaceBetween,
children: List.generate(
16,
(index) => Tag(
'钓鱼',
border: Border.all(width: .5, color: WcaoTheme.outline),
backgroundColor: Colors.white,
color: WcaoTheme.base,
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
borderRadius: BorderRadius.circular(24),
),
),
);
}

Wrap tabbarView2() {
return Wrap(
runSpacing: 12,
spacing: 12,
alignment: WrapAlignment.spaceBetween,
children: List.generate(
16,
(index) => Tag(
'90年代',
border: Border.all(width: .5, color: WcaoTheme.outline),
backgroundColor: Colors.white,
color: WcaoTheme.base,
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
borderRadius: BorderRadius.circular(24),
),
),
);
}

Wrap tabbarView1() {
return Wrap(
runSpacing: 12,
spacing: 12,
alignment: WrapAlignment.spaceBetween,
children: List.generate(
16,
(index) => Tag(
'双鱼座',
border: Border.all(width: .5, color: WcaoTheme.outline),
backgroundColor: Colors.white,
color: WcaoTheme.base,
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 12),
borderRadius: BorderRadius.circular(24),
),
),
);
}
}
39 changes: 29 additions & 10 deletions lib/pages/home/mine/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,35 @@ class _PageViewMineState extends State<PageViewMine> {
runSpacing: 6,
children: List.generate(
mine.tags.length,
(index) => Tag(
mine.tags[index],
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
backgroundColor: Colors.black.withOpacity(.4),
color: Colors.white,
borderRadius: BorderRadius.circular(24),
fontSize: WcaoTheme.fsBase,
fontWeight: FontWeight.bold,
),
(index) {
if (index >= mine.tags.length - 1) {
// 添加标签
return InkWell(
onTap: () => Get.toNamed('/mine/add-tag'),
child: Tag(
'+',
padding: const EdgeInsets.symmetric(
horizontal: 24, vertical: 4),
backgroundColor: Colors.black.withOpacity(.4),
color: Colors.white,
borderRadius: BorderRadius.circular(24),
fontSize: WcaoTheme.fsBase,
fontWeight: FontWeight.bold,
),
);
} else {
return Tag(
mine.tags[index],
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 4),
backgroundColor: Colors.black.withOpacity(.4),
color: Colors.white,
borderRadius: BorderRadius.circular(24),
fontSize: WcaoTheme.fsBase,
fontWeight: FontWeight.bold,
);
}
},
).toList(),
),
),
Expand Down
2 changes: 2 additions & 0 deletions lib/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter_dating_template/pages/agreement/privacy.dart';
import 'package:flutter_dating_template/pages/agreement/user.dart';
import 'package:flutter_dating_template/pages/history_match/index.dart';
import 'package:flutter_dating_template/pages/home/index.dart';
import 'package:flutter_dating_template/pages/home/mine/add_tag/index.dart';
import 'package:flutter_dating_template/pages/login/password.dart';
import 'package:flutter_dating_template/pages/login/verify_code.dart';
import 'package:flutter_dating_template/pages/settings/about/index.dart';
Expand Down Expand Up @@ -42,4 +43,5 @@ List<GetPage<dynamic>> getRoutes = [
GetPage(name: '/settings/privacy', page: () => const SettingsPrivacy()),
GetPage(name: '/settings/backlist', page: () => const SettingsBacklist()),
GetPage(name: '/settings/about', page: () => const SettingsAbout()),
GetPage(name: "/mine/add-tag", page: () => const MineAddTag()),
];
10 changes: 4 additions & 6 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,10 @@ packages:
flutter_wcao:
dependency: "direct main"
description:
path: "."
ref: main
resolved-ref: "934d579ad23a9c7e99c228dc858ef2446a125ef1"
url: "[email protected]:cu-yang/flutter_wcao.git"
source: git
version: "0.0.3+1"
name: flutter_wcao
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.3+2"
flutter_web_plugins:
dependency: transitive
description: flutter
Expand Down
5 changes: 1 addition & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ dependencies:
group_button: ^5.0.1
pull_to_refresh: ^2.0.0
dart_mock: ^2.0.0
flutter_wcao:
git:
url: [email protected]:cu-yang/flutter_wcao.git
ref: main
flutter_wcao: ^0.0.3+2

dev_dependencies:
flutter_test:
Expand Down
Binary file added readme/preview/添加标签.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2288d6c

Please sign in to comment.