问题描述
我是新手,如何在 Flutter_deep_linking-master / 多级项目中使用插件 URL 启动器从这个扩展 StatelessWidget 中获取变量值
如何获取${person.pdf}的变量值并将其插入String link = variable; 并将这个新变量放在 onClicked: () => Utils.openLink(url: link),
class PersonPage extends StatelessWidget {
final Family family;
final Person person;
const PersonPage({required this.family,required this.person,Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: Text(person.name)),body:
Text('\n\n' ' Le manuel recherché du ${family.name} ${person.name} est ici : \n\n'
' => **${person.pdf}** \n\n'));
}
//get the variable value of ${person.pdf} and insert it in : String link = => variable_value;
String link = variable_value;
class PersonPage extends StatelessWidget {
final Family family;
final Person person;
const PersonPage({required this.family,Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: Text(person.name)),body:
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,children: [
buildButton(
text: 'Lien fichier pdf',//put this new variable in : (url: link),onClicked: () => Utils.openLink(url: =>link),),],);
Widget buildButton({
required String text,required VoidCallback onClicked,}) =>
Container(
padding: const EdgeInsets.symmetric(vertical: 12),child: ElevatedButton(
onpressed: onClicked,child: Text(
text,style: TextStyle(fontSize: 24),);
}
class Four04Page extends StatelessWidget {
final String message;
const Four04Page({required this.message,Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text('Page Not Found')),body: Center(child: Text(message)),);
}
'谢谢'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)