Skip to content

Commit

Permalink
feat:详情页面增加返回键
Browse files Browse the repository at this point in the history
  • Loading branch information
Tecode committed Aug 21, 2024
1 parent 1fbf0e7 commit c27a0b1
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions lib/containers/discovery_detail.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import 'dart:io';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:dynamic_theme/widgets/common/nav_back_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class DiscoveryDetail extends StatefulWidget {
Expand Down Expand Up @@ -52,23 +56,33 @@ class _DiscoveryDetailState extends State<DiscoveryDetail> with SingleTickerProv
}

@override
Widget build(BuildContext context) => Material(
child: GestureDetector(
onDoubleTap: _handleDoubleTap,
onDoubleTapDown: (details) => _doubleTapDetails = details,
// onTap: () => _controller.value,
behavior: HitTestBehavior.opaque,
child: Hero(
tag: widget.tag ?? '',
child: Center(
child: InteractiveViewer(
clipBehavior: Clip.none,
transformationController: _controller,
child: CachedNetworkImage(
progressIndicatorBuilder: (context, url, progress) =>
Container(color: Theme.of(context).canvasColor),
imageUrl: widget.url ?? '',
fit: BoxFit.fitWidth,
Widget build(BuildContext context) => CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
border: null,
backgroundColor: Colors.transparent,
padding: EdgeInsetsDirectional.zero,
transitionBetweenRoutes: Platform.isIOS,
middle: const Text('Discovery Detail'),
leading: NavBackButton(onTap: () => Navigator.pop(context, '数据传参')),
),
child: Material(
child: GestureDetector(
onDoubleTap: _handleDoubleTap,
onDoubleTapDown: (details) => _doubleTapDetails = details,
// onTap: () => _controller.value,
behavior: HitTestBehavior.opaque,
child: Hero(
tag: widget.tag ?? '',
child: Center(
child: InteractiveViewer(
clipBehavior: Clip.none,
transformationController: _controller,
child: CachedNetworkImage(
progressIndicatorBuilder: (context, url, progress) =>
Container(color: Theme.of(context).canvasColor),
imageUrl: widget.url ?? '',
fit: BoxFit.fitWidth,
),
),
),
),
Expand Down

0 comments on commit c27a0b1

Please sign in to comment.