Closed no1-knows closed 4 years ago
I'm sorry it's normal question. Not bug report....
This sample code works with uni_links!!
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:uni_links/uni_links.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "newapp",
debugShowCheckedModeBanner: false,
home: HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen>
with SingleTickerProviderStateMixin {
InAppWebViewController webView;
String url = "";
double progress = 0;
StreamSubscription _sub;
@override
void initState() {
super.initState();
}
@override
dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('InAppWebView Example'),
),
body: Container(
child: Column(children: <Widget>[
Container(
padding: EdgeInsets.all(5.0),
child: progress < 1.0
? LinearProgressIndicator(value: progress)
: Container()),
Expanded(
child: Container(
decoration: BoxDecoration(border: Border.all(color: Colors.blue)),
child: StreamBuilder(
stream: getLinksStream(),
builder: (context, snapshot) {
if (snapshot.hasData) {
url = snapshot.data;
}else{
url = "https://example.com/";
}
if (url != "") {
return InAppWebView(
initialUrl: url,
initialHeaders: {},
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
debuggingEnabled: true,
)),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart:
(InAppWebViewController controller, String url) {
setState(() {
this.url = url;
});
},
onLoadStop: (InAppWebViewController controller,
String url) async {
setState(() {
this.url = url;
});
},
onProgressChanged:
(InAppWebViewController controller, int progress) {
setState(() {
this.progress = progress / 100;
});
},
);
}
return CircularProgressIndicator();
}),
),
),
])),
);
}
}
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.
Hello! I'm newbie for smartphone app. I would like to open the webpage at inappview which is as same as universal links url on mail app.
It's kind of like below. If I got mail with authentication links like "http://example.com/sign_in/wtCpS0ObF-UMjvzev" and I tap it, then I would like to open my app and show the above page. But my app doesn't change the page.
What is done
// return Text(url);
Any information would greatly help.