【发布时间】:2021-07-09 11:28:31
【问题描述】:
我想在现有应用中实现特定应用是否安装的条件。
条件:
the first app is that which is I'm going to build
Second app that is required for run first app
- 如果已安装应用(第二个应用),则在第一个应用中运行
HomePage() - 如果未安装应用程序,则显示安装应用程序的弹出窗口或警报。
第一个应用的根代码
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Future.delayed(Duration(seconds: 2)),
builder: (context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return MaterialApp(
home: Splash(),
debugShowCheckedModeBanner: false,
);
} else {
return StreamBuilder(
stream: Connectivity().onConnectivityChanged,
builder: (context, AsyncSnapshot<ConnectivityResult> snapshot) {
return snapshot.data == ConnectivityResult.mobile ||
snapshot.data == ConnectivityResult.wifi
? MaterialApp(
title: 'mFollower',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Homepage(),
debugShowCheckedModeBanner: false,
)
: NoInternet();
},
);
}
});
}
}
【问题讨论】:
标签: flutter flutter-dependencies installed-applications