Skip to content

Commit

Permalink
1. 从底栏中删除投稿页
Browse files Browse the repository at this point in the history
2. 调整卡片阴影
  • Loading branch information
神楽坂花火 committed Mar 14, 2020
1 parent 012e5a7 commit d8a17bc
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 59 deletions.
28 changes: 21 additions & 7 deletions lib/pages/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'dart:convert';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dailypics/misc/bean.dart';
import 'package:dailypics/model/app.dart';
import 'package:dailypics/pages/upload.dart';
import 'package:dailypics/utils/api.dart';
import 'package:dailypics/utils/utils.dart';
import 'package:dailypics/widget/image_card.dart';
Expand Down Expand Up @@ -81,13 +82,13 @@ class _AboutPageState extends State<AboutPage> {
child: _buildList(),
),
),
const CupertinoNavigationBar(
middle: Text('更多'),
/*trailing: CupertinoButton(
CupertinoNavigationBar(
middle: const Text('更多'),
trailing: CupertinoButton(
padding: EdgeInsets.zero,
child: Text('测试入口'),
onPressed: () => UserSpacePage.push(context),
),*/
child: const Text('投稿'),
onPressed: () => UploadPage.push(context),
),
)
],
),
Expand Down Expand Up @@ -288,7 +289,20 @@ class _AboutPageState extends State<AboutPage> {
'C-$i-${data[i].id}',
padding: const EdgeInsets.all(12),
showTexts: false,
blurRadius: 64,
boxShadow: const [
BoxShadow(
color: Color(0x1F000000),
offset: Offset(0, 3),
spreadRadius: -16,
blurRadius: 8,
),
BoxShadow(
color: Color(0x0A000000),
offset: Offset(0, 3),
spreadRadius: -16,
blurRadius: 1,
),
],
);
},
);
Expand Down
4 changes: 3 additions & 1 deletion lib/pages/details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ class _DetailsPageState extends State<DetailsPage> {

Widget _buildContent() {
CupertinoThemeData theme = CupertinoTheme.of(context);
TextStyle textStyle = theme.textTheme.textStyle;
TextStyle textStyle = theme.textTheme.textStyle.copyWith(
fontSize: 16,
);
return MarkdownBody(
data: data.content,
onTapLink: (String href) => SystemUtils.openUrl(href),
Expand Down
6 changes: 1 addition & 5 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import 'package:dailypics/components/today.dart';
import 'package:dailypics/pages/about.dart';
import 'package:dailypics/pages/details.dart';
import 'package:dailypics/pages/recent.dart';
import 'package:dailypics/pages/upload.dart';
import 'package:dailypics/utils/utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -64,7 +63,6 @@ class _HomePageState extends State<HomePage> {
items: [
_buildNavigationItem(Ionicons.ios_today, 'Today'),
_buildNavigationItem(Ionicons.ios_time, '以往'),
_buildNavigationItem(Ionicons.ios_paper_plane, '投稿'),
_buildNavigationItem(Ionicons.ios_flame, '推荐 '),
_buildNavigationItem(Ionicons.ios_settings, '更多'),
],
Expand All @@ -76,10 +74,8 @@ class _HomePageState extends State<HomePage> {
case 1:
return CupertinoTabView(builder: (_) => RecentPage());
case 2:
return CupertinoTabView(builder: (_) => UploadPage());
case 3:
return CupertinoTabView(builder: (_) => SuggestComponent());
case 4:
case 3:
return CupertinoTabView(builder: (_) => AboutPage());
default:
return null;
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/recent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class _TileState extends State<_Tile> {
offstage: !widget.data.marked,
child: const Padding(
padding: EdgeInsets.only(left: 8),
child: Icon(Ionicons.ios_star, size: 18),
child: Icon(Ionicons.ios_heart, size: 18),
),
),
],
Expand Down
20 changes: 9 additions & 11 deletions lib/pages/upload.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ class _UploadPageState extends State<UploadPage> {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('投稿'),
navigationBar: CupertinoNavigationBar(
padding: EdgeInsetsDirectional.zero,
leading: CupertinoButton(
child: const Icon(CupertinoIcons.back),
padding: EdgeInsets.zero,
onPressed: () => Navigator.of(context).pop(),
),
middle: const Text('投稿'),
),
child: SafeArea(
bottom: false,
Expand Down Expand Up @@ -271,14 +277,6 @@ class _UploadPageState extends State<UploadPage> {
);
}

void _clearAll() {
imageFile = null;
title.clear();
content.clear();
username.clear();
type = null;
}

void _onSubmitted() async {
if (progress != -1) return;
List<String> errors = [];
Expand Down Expand Up @@ -337,8 +335,8 @@ class _UploadPageState extends State<UploadPage> {
setState(() => progress = -1);
await _showAlertDialog('投稿失败,因为:' + json2['msg']);
} else {
_clearAll();
await _showAlertDialog('投稿成功,请等待管理员审核');
Navigator.of(context).pop();
}
}
}
Expand Down
68 changes: 34 additions & 34 deletions lib/widget/image_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ class ImageCard extends StatefulWidget {
this.heroTag, {
this.padding = const EdgeInsets.all(16),
this.aspectRatio = 4 / 5,
this.blurRadius = 32,
this.boxShadow = const [
BoxShadow(
color: Colors.black26,
offset: Offset(0, 4),
spreadRadius: -24,
blurRadius: 32,
)
],
this.showTexts = true,
this.showQrCode = false,
this.repaintKey,
Expand All @@ -42,7 +49,7 @@ class ImageCard extends StatefulWidget {

final double aspectRatio;

final double blurRadius;
final List<BoxShadow> boxShadow;

final bool showQrCode;

Expand Down Expand Up @@ -76,14 +83,7 @@ class _ImageCardState extends State<ImageCard> {
padding: widget.padding,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black26,
offset: const Offset(0, 4),
spreadRadius: 8 - widget.blurRadius,
blurRadius: widget.blurRadius,
)
],
boxShadow: widget.boxShadow,
),
child: GestureDetector(
onTapDown: (_) {
Expand Down Expand Up @@ -116,34 +116,34 @@ class _ImageCardState extends State<ImageCard> {
),
if (widget.showTexts)
Padding(
padding: const EdgeInsets.fromLTRB(16, 32, 24, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.data.title,
style: TextStyle(
color: textColor,
fontWeight: FontWeight.w500,
fontSize: 28,
),
),
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
markdownToHtml(widget.data.content.split('\n')[0])
.replaceAll(RegExp(r'<[^>]+>'), ''),
maxLines: 2,
overflow: TextOverflow.ellipsis,
padding: const EdgeInsets.fromLTRB(16, 32, 24, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.data.title,
style: TextStyle(
color: textColor.withAlpha(0xB3),
fontSize: 13,
color: textColor,
fontWeight: FontWeight.w500,
fontSize: 28,
),
),
),
],
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
markdownToHtml(widget.data.content.split('\n')[0])
.replaceAll(RegExp(r'<[^>]+>'), ''),
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor.withAlpha(0xB3),
fontSize: 13,
),
),
),
],
),
),
),
if (widget.showQrCode)
AspectRatio(
aspectRatio: widget.aspectRatio,
Expand Down

0 comments on commit d8a17bc

Please sign in to comment.