11import 'package:flutter/material.dart' ;
22import 'package:flutter/services.dart' ;
33import 'package:intl/intl.dart' ;
4- import 'dart:html' as html;
4+ import 'package:web/web.dart' as web;
5+ import 'dart:js_interop' ;
6+
57import 'package:markdown_widget/markdown_widget.dart' ;
68import 'package:sando_diary/model/post_meta.dart' ;
79
@@ -25,15 +27,17 @@ class _PostListPageState extends State<PostListPage> {
2527 }
2628
2729 void _launchURLInNewTab (String url) {
28- html .window.open (url, '_blank' );
30+ web .window.open (url, '_blank' );
2931 }
3032
3133 void _copyCurrentPostUrlToClipboard () {
32- final currentUrl = html.window.location.href; // 현재 페이지의 URL 가져오기
33- Clipboard .setData (ClipboardData (text: currentUrl)); // URL을 클립보드에 복사
34+ final postUrl =
35+ Uri .base .resolve ('/posts/${currentPost .meta .slug }' ).toString ();
36+ print ('Copy URL: $postUrl ' );
37+ Clipboard .setData (ClipboardData (text: postUrl));
3438
3539 ScaffoldMessenger .of (context).showSnackBar (
36- SnackBar (content: Text ('URL copied to clipboard!' )),
40+ const SnackBar (content: Text ('URL copied to clipboard!' )),
3741 );
3842 }
3943
@@ -52,7 +56,7 @@ class _PostListPageState extends State<PostListPage> {
5256 data: currentDoc.body,
5357 config: MarkdownConfig (configs: [
5458 LinkConfig (
55- style: TextStyle (
59+ style: const TextStyle (
5660 color: Colors .cyan,
5761 decoration: TextDecoration .underline,
5862 ),
@@ -72,7 +76,7 @@ class _PostListPageState extends State<PostListPage> {
7276 return Scaffold (
7377 appBar: ! isShowPostDetail
7478 ? AppBar (
75- title: Text ('Blog Posts' ),
79+ title: const Text ('Blog Posts' ),
7680 )
7781 : AppBar (
7882 elevation: 0 ,
@@ -84,7 +88,7 @@ class _PostListPageState extends State<PostListPage> {
8488 leading: BackButton (
8589 onPressed: () => setState (() {
8690 isShowPostDetail = false ;
87- html .window.history.pushState (null , 'Posts' , '/' );
91+ web .window.history.pushState (null , 'Posts' , '/' );
8892 }),
8993 ),
9094 actions: [
0 commit comments