59 lines
2.6 KiB
Dart
59 lines
2.6 KiB
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
|
import 'package:manager_api_new/api.dart';
|
|
import 'package:mymuseum_visitapp/Helpers/translationHelper.dart';
|
|
import 'package:mymuseum_visitapp/Models/resourceModel.dart';
|
|
import 'package:mymuseum_visitapp/Models/visitContext.dart';
|
|
import 'package:mymuseum_visitapp/app_context.dart';
|
|
import 'package:mymuseum_visitapp/constants.dart';
|
|
import 'package:photo_view/photo_view.dart';
|
|
|
|
void showImagePopup(ContentDTO contentDTO, ResourceModel resourceModel, AppContext appContext, BuildContext context, Size size, File? resourceModelFile) {
|
|
showDialog(
|
|
builder: (BuildContext context) => AlertDialog(
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0))
|
|
),
|
|
content: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
if(TranslationHelper.get(contentDTO.title, appContext.getContext()).isNotEmpty)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8.0, left:8.0, right: 8.0),
|
|
child: HtmlWidget(
|
|
TranslationHelper.get(contentDTO.title, appContext.getContext()),
|
|
textStyle: const TextStyle(fontSize: kArticleContentSize, fontWeight: FontWeight.w400)),
|
|
),
|
|
SizedBox(
|
|
height: size.height * 0.5,
|
|
width: size.width * 0.95,
|
|
child: Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left:8.0, right: 8.0, bottom: 8.0, top: 8.0),
|
|
child: PhotoView(
|
|
imageProvider: (appContext.getContext() as VisitAppContext).configuration!.isOffline! && resourceModelFile != null ?
|
|
Image.file(resourceModelFile).image : // GET FROM FILE
|
|
Image.network(resourceModel.source!).image,
|
|
minScale: PhotoViewComputedScale.contained * 1.0,
|
|
maxScale: PhotoViewComputedScale.contained * 3.0,
|
|
backgroundDecoration: const BoxDecoration(
|
|
color: Colors.transparent,
|
|
/*shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(15.0),*/
|
|
),
|
|
),/*Image.memory(base64Decode(resourceModel!.data!)),*/
|
|
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
contentPadding: EdgeInsets.zero,
|
|
), context: context
|
|
);
|
|
}
|