This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| arb-dir: lib/l10n | |
| template-arb-file: app_en.arb | |
| output-localization-file: app_localizations.dart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "@@locale": "en", | |
| "hello_world": "Hello World!", | |
| "@hello_world": { | |
| "description": "The conventional newborn programmer greeting" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "@@locale": "zh", | |
| "hello_world": "你好,世界" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:l10n_demo/l10n/app_localizations.dart'; // Add this line. | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _MyHomePageState extends State<MyHomePage> { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | |
| // Replace the title line with the following: | |
| title: Text(AppLocalizations.of(context).hello_world), | |
| ), | |
| // The rest of the widget tree. | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RequiresApi(Build.VERSION_CODES.N) | |
| class LiffShareTileService : TileService() { | |
| ... | |
| override fun onClick() { | |
| super.onClick() | |
| // 將 LINE Share App的主畫面叫起 | |
| val intent = Intent(this, MainActivity::class.java).apply { | |
| addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onWindowFocusChanged(hasFocus: Boolean) { | |
| super.onWindowFocusChanged(hasFocus) | |
| // what the heck! 這件事做在 onResume() 中是沒有用的。害我試了好久 | |
| val clipBoardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager | |
| val copiedString = clipBoardManager.primaryClip?.getItemAt(0)?.text?.toString() ?: "" | |
| if (copiedString.isNotEmpty()) { | |
| handleSendText(copiedString) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function previewUrlInfo(url, isAutoSend = false) { | |
| // handle facebook no preview issue | |
| var oldUrl = new URL(url); | |
| if (oldUrl.hostname.includes('facebook')) { | |
| oldUrl.hostname = 'mobile.facebook.com'; | |
| } | |
| ... | |
| ... | |
| } |