1

I'm newbie, just how get variable value from this extends StatelessWidget in a flutter_deep_linking-master / multi level project using plugin URL launcher

how get the variable value of ${person.pdf} and insert it in String link = variable; and put this new variable in 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, required this.person, 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)),
      );
}

'thanks'

Patricio
  • 11
  • 2

0 Answers0