|
|
@@ -81,6 +81,10 @@ class ImageViewerPage extends BasePage<ImageViewerController> {
|
|
|
},
|
|
|
builder: (BuildContext context, int index) {
|
|
|
return PhotoViewGalleryPageOptions.customChild(
|
|
|
+ onTapDown: (context, details, controllerValue) {
|
|
|
+ // 切换标题栏的显示和隐藏
|
|
|
+ controller.toggleShowTitleBar();
|
|
|
+ },
|
|
|
minScale: PhotoViewComputedScale.contained,
|
|
|
maxScale: PhotoViewComputedScale.covered * 2,
|
|
|
initialScale: PhotoViewComputedScale.contained * 0.8,
|
|
|
@@ -162,41 +166,46 @@ class ImageViewerPage extends BasePage<ImageViewerController> {
|
|
|
|
|
|
/// 标题栏
|
|
|
Widget _buildTitleBar() {
|
|
|
- return Container(
|
|
|
- height: kToolbarHeight,
|
|
|
- // 宽度,匹配父组件
|
|
|
- width: double.infinity,
|
|
|
- color: ColorName.black,
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 14.0),
|
|
|
- child: Stack(
|
|
|
- children: [
|
|
|
- // 返回按钮
|
|
|
- GestureDetector(
|
|
|
- onTap: controller.clickBack,
|
|
|
- child: Assets.images.iconImageViewerClose.image(
|
|
|
- width: 24.w,
|
|
|
- height: 24.h,
|
|
|
- ),
|
|
|
- ),
|
|
|
- // 标题
|
|
|
- Positioned(
|
|
|
- left: 0,
|
|
|
- top: 0,
|
|
|
- right: 0,
|
|
|
- child: Container(
|
|
|
- alignment: Alignment.center,
|
|
|
- child: Text(
|
|
|
- StringName.preview,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 16.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- color: ColorName.white,
|
|
|
+ return Obx(() {
|
|
|
+ return Visibility(
|
|
|
+ visible: controller.isShowTitleBar.value,
|
|
|
+ child: Container(
|
|
|
+ height: kToolbarHeight,
|
|
|
+ // 宽度,匹配父组件
|
|
|
+ width: double.infinity,
|
|
|
+ color: ColorName.black,
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 14.0),
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ // 返回按钮
|
|
|
+ GestureDetector(
|
|
|
+ onTap: controller.clickBack,
|
|
|
+ child: Assets.images.iconImageViewerClose.image(
|
|
|
+ width: 24.w,
|
|
|
+ height: 24.h,
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
+ // 标题
|
|
|
+ Positioned(
|
|
|
+ left: 0,
|
|
|
+ top: 0,
|
|
|
+ right: 0,
|
|
|
+ child: Container(
|
|
|
+ alignment: Alignment.center,
|
|
|
+ child: Text(
|
|
|
+ StringName.preview,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ color: ColorName.white,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
),
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
}
|