|
|
|
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_html/flutter_html.dart';
|
|
|
|
import 'package:flutter_html/image_render.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/activity.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/article.dart';
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
import 'package:share/share.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
class StoreDetailsPage extends StatefulWidget {
|
|
|
|
final Map<String, dynamic> arguments;
|
|
|
|
|
|
|
|
StoreDetailsPage({this.arguments});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _StoreDetailsPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _StoreDetailsPage extends State<StoreDetailsPage> {
|
|
|
|
|
|
|
|
ApiService apiService;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) {
|
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token"));
|
|
|
|
queryHtml();
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Activity activity;
|
|
|
|
Article article;
|
|
|
|
|
|
|
|
queryHtml() async {
|
|
|
|
BaseData baseData = await apiService.informationInfo(widget.arguments["activityId"] ?? widget.arguments["articleId"]);
|
|
|
|
|
|
|
|
if(baseData != null && baseData.isSuccess) {
|
|
|
|
if (widget.arguments.containsKey("activityId")) {
|
|
|
|
activity = Activity.fromJson(baseData.data);
|
|
|
|
} else if (widget.arguments.containsKey("articleId")) {
|
|
|
|
article = Article.fromJson(baseData.data);
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
appBar: MyAppBar(
|
|
|
|
action: Container(
|
|
|
|
margin: EdgeInsets.only(right: 15),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
Share.share('http://share-app.api.lotus-wallet.com/#/share?id=${widget.arguments["activityId"] ?? widget.arguments["articleId"]}');
|
|
|
|
},
|
|
|
|
child: Icon(
|
|
|
|
Icons.share,
|
|
|
|
size: 24,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
background: Color(0xFFF7F7F7),
|
|
|
|
leadingColor: Colors.black,
|
|
|
|
title: activity != null ? activity.mainTitle : article != null ? article.mainTitle : "",
|
|
|
|
titleSize: 18.sp,
|
|
|
|
titleColor: Colors.black,
|
|
|
|
),
|
|
|
|
body: Container(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
activity != null ? activity.mainTitle : article != null ? article.mainTitle : "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
child: Text(
|
|
|
|
"${activity != null ? activity.storeName : (article != null && article.author != null) ? article.author.name : ""}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
color: Colors.blue,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
if(activity != null) {
|
|
|
|
Navigator.of(context).pushNamed('/router/union_detail_page',
|
|
|
|
arguments: {"id": activity.storeId});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 10,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
activity != null ? activity.createTime : article != null ? article.createTime : "",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
fontSize: 12.sp,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Html(
|
|
|
|
data: activity != null ? activity.content : article != null ? article.content : "",
|
|
|
|
customImageRenders: {
|
|
|
|
base64DataUriMatcher(): base64ImageRender(),
|
|
|
|
assetUriMatcher(): assetImageRender(),
|
|
|
|
networkSourceMatcher(extension: "svg"): svgNetworkImageRender(),
|
|
|
|
networkSourceMatcher(): networkImageRender(
|
|
|
|
loadingWidget: () {
|
|
|
|
// return Image.asset("assets/image/default_1.png",);
|
|
|
|
return Container();
|
|
|
|
}
|
|
|
|
),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|