微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何从中获取变量值在 flutter_deep_linking-master / 多级项目中扩展 StatelessWidget

如何解决如何从中获取变量值在 flutter_deep_linking-master / 多级项目中扩展 StatelessWidget

我是新手,如何在 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 举报,一经查实,本站将立刻删除。