diff --git a/lib/src/pages/word_page.dart b/lib/src/pages/word_page.dart index aae9d18..b770f54 100644 --- a/lib/src/pages/word_page.dart +++ b/lib/src/pages/word_page.dart @@ -1,3 +1,4 @@ +import 'package:el_meu_diec/src/routes/diec_routes.dart'; import 'package:el_meu_diec/src/widgets/autocomplete_entry_card.dart'; import 'package:el_meu_diec/src/widgets/bookmark_button.dart'; import 'package:flutter/material.dart'; @@ -31,12 +32,7 @@ class WordPage extends StatelessWidget { actions: [ BookmarkButton(word: word, isTonalFilled: true), IconButton.filledTonal( - onPressed: () => Share.shareUri( - Uri.https('dlc.iec.cat', '/Results', { - 'IdE': word.id, - 'DecEntradaText': word.word, - }), - ), + onPressed: () => Share.shareUri(const DIECRoutes().wordUri(word)), icon: const Icon(Icons.ios_share_rounded), ), const SizedBox(width: 4), diff --git a/lib/src/routes/diec_routes.dart b/lib/src/routes/diec_routes.dart new file mode 100644 index 0000000..3b7f004 --- /dev/null +++ b/lib/src/routes/diec_routes.dart @@ -0,0 +1,15 @@ +import 'package:flutter/foundation.dart'; + +import '../model/word.dart'; + +@immutable +final class DIECRoutes { + final String authority; + + const DIECRoutes({this.authority = 'dlc.iec.cat'}); + + Uri wordUri(Word word) => Uri.https(authority, '/Results', { + 'IdE': word.id, + 'DecEntradaText': word.word, + }); +}