Browse Source

加更;

ff_new
w-R 3 years ago
parent
commit
8ad6a4895c
  1. 1
      lib/home/home_page.dart
  2. 2
      lib/main.dart
  3. 185
      lib/web/web_turntable_activity.dart

1
lib/home/home_page.dart

@ -326,6 +326,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
totalMsg = 0; totalMsg = 0;
}); });
}); });
// Navigator.of(context).pushNamed('/router/web_turntable_activity');
}, },
child: Container( child: Container(
height: 24, height: 24,

2
lib/main.dart

@ -302,7 +302,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/store_selector_page': (context, {arguments}) => StoreSelectorPage(), '/router/store_selector_page': (context, {arguments}) => StoreSelectorPage(),
'/router/video_playback_page': (context, {arguments}) => VideoPlaybackPage(), '/router/video_playback_page': (context, {arguments}) => VideoPlaybackPage(),
'/router/web_page': (context, {arguments}) => WebPage(arguments: arguments), '/router/web_page': (context, {arguments}) => WebPage(arguments: arguments),
'/router/web_turntable_activity': (context, {arguments}) => WebTurntableActivity(arguments: arguments), '/router/web_turntable_activity': (context, {arguments}) => WebTurntableActivity(),
'/router/help_feedback_page': (context, {arguments}) => HelpFeedbackPage(), '/router/help_feedback_page': (context, {arguments}) => HelpFeedbackPage(),
'/router/founder_story_page': (context, {arguments}) => FounderStoryPage(), '/router/founder_story_page': (context, {arguments}) => FounderStoryPage(),
'/router/system_msg_page': (context, {arguments}) => SystemMessagePage(), '/router/system_msg_page': (context, {arguments}) => SystemMessagePage(),

185
lib/web/web_turntable_activity.dart

@ -1,148 +1,8 @@
import 'dart:io';
import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.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/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/share_dialog.dart';
import 'package:huixiang/view_widget/tips_dialog.dart';
import 'package:huixiang/web/web_view/comment_list.dart';
import 'package:huixiang/web/web_view/input_comment.dart';
import 'package:huixiang/web/web_view/web_content.dart';
import 'package:huixiang/web/web_view/web_header.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sharesdk_plugin/sharesdk_defines.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart';
import 'package:sharesdk_plugin/sharesdk_map.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
import 'package:flutter/cupertino.dart';
class WebTurntableActivity extends StatefulWidget {
final Map<String, dynamic> arguments;
///
WebTurntableActivity({this.arguments});
@override
State<StatefulWidget> createState() {
return _WebTurntableActivity();
}
}
class _WebTurntableActivity extends State<WebTurntableActivity> with WidgetsBindingObserver {
ApiService apiService;
var commentFocus = FocusNode();
final double fontSize = 16.sp;
final ScrollController scrollController = ScrollController();
Activity activity;
Article article;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
queryHtml();
}
bool isKeyBoardShow = false;
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
queryHtml() async { class WebTurntableActivity extends StatelessWidget {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
// if (widget.arguments["activityId"] != null) {
// BaseData<Activity> baseData = await apiService
// .activityInfo(widget.arguments["activityId"])
// .catchError((onError) {});
// if (baseData != null && baseData.isSuccess) {
// activity = baseData.data;
// setState(() {});
// }
// }
// if (widget.arguments["articleId"] != null) {
// BaseData<Article> baseData = await apiService
// .informationInfo(widget.arguments["articleId"])
// .catchError((onError) {});
// if (baseData != null && baseData.isSuccess) {
// article = baseData.data;
// setState(() {});
// }
// }
}
share() async {
SSDKMap params = SSDKMap()
..setGeneral(
activity != null
? activity.mainTitle
: article != null
? article.mainTitle
: "",
activity != null
? activity.viceTitle
: article != null
? article.viceTitle
: "",
[
activity != null
? activity.coverImg
: article != null
? article.coverImg
: "",
],
activity != null
? activity.coverImg
: article != null
? article.coverImg
: "",
"",
buildShareUrl(),
"",
"",
"",
"",
SSDKContentTypes.webpage,
);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return ShareDialog((platform) {
if (platform == ShareSDKPlatforms.line) {
params.map["type"] = SSDKContentTypes.text.value;
params.map["text"] =
"${activity != null ? activity.viceTitle : article != null ? article.viceTitle : ""} ${buildShareUrl()}";
}
SharesdkPlugin.share(platform, params,
(state, userData, contentEntity, error) {
print("share!$state");
});
});
});
}
String buildShareUrl() {
return "https://hx.lotus-wallet.com/index.html?id=${widget.arguments["activityId"] ?? widget.arguments["articleId"]}&type=${activity != null ? "activity" : article != null ? "article" : ""}";
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -152,7 +12,7 @@ class _WebTurntableActivity extends State<WebTurntableActivity> with WidgetsBind
margin: EdgeInsets.only(right: 10), margin: EdgeInsets.only(right: 10),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
share(); // share();
}, },
child: Icon( child: Icon(
Icons.share, Icons.share,
@ -161,42 +21,17 @@ class _WebTurntableActivity extends State<WebTurntableActivity> with WidgetsBind
), ),
), ),
), ),
title: "",
background: Color(0xFFFFFFFFF), background: Color(0xFFFFFFFFF),
leadingColor: Colors.black, leadingColor: Colors.black,
), ),
body: Container( body: Container(
child: Column( width: MediaQuery.of(context).size.width,
children: [ height: MediaQuery.of(context).size.height,
Expanded( child:
child: GestureDetector( WebView(
onTap: () { initialUrl: "http://192.168.10.90:5500/lottery.html",
commentFocus.unfocus(); )),
},
child: SingleChildScrollView(
controller: scrollController,
physics: BouncingScrollPhysics(),
child: Column(
children: [
///
WebHeader(widget.arguments, activity, article, 16),
///
WebContent(
activity,
article,
() {
setState(() {});
},
),
],
),
),
),
flex: 1,
),
],
),
),
); );
} }
} }
Loading…
Cancel
Save