This file contains 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 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 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 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 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
dependencies: | |
flutter: | |
sdk: flutter | |
# Internationalization support. | |
flutter_localizations: | |
sdk: flutter | |
intl: 0.16.1 | |
# the rest of your dependencies |
This file contains 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
// Implement a function to create OverlayEntry | |
OverlayEntry getMyOverlayEntry({ | |
@required BuildContext context, | |
SomeData someData, | |
}) { | |
return OverlayEntry( | |
builder: (context) { | |
return AlertDialog(child: SomeWidgetAgain()); | |
} | |
); |
This file contains 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
// 建立 loadbalancer object,指定想要產生的 isolate 數目 | |
Future<LoadBalancer> loadBalancer = LoadBalancer.create(8, IsolateRunner.spawn); | |
typedef Uint8List ImageProcessFunction(Uint8List bytes); | |
// 將 loadBalancer 相關操作包成 function。 這一步並非是必要的,可以直接使用 line 9 和 line 11。 | |
Future<Uint8List> loadBalancerRun(ImageProcessFunction function, Uint8List bytes) async { | |
// 在使用 loadBalancer 時,要先 await 一下,取得資源 | |
final lb = await loadBalancer; | |
// 呼叫 lb.run,執行原本 compute 在進行的工作 |
This file contains 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
sequenceDiagram | |
Activity->>+NinjiaWebView: 1.loadUrl(normalUrl) | |
NinjiaWebView->>WebKitEngine: 2. trigger loading | |
WebKitEngine-->>NinjiaWebView: 3. onPageFinished() | |
NinjiaWebView->>NinjiaWebView: 4. injectCSS() | |
NinjiaWebView->>-NinjiaWebView: 5. loadUrl(javascript) |
This file contains 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
webView.setWebViewClient(new WebViewClient() { | |
@Override | |
public void onPageFinished(WebView view, String url) { | |
injectCSS(); | |
injectJS(); | |
super.onPageFinished(view, url); | |
} | |
}); |
This file contains 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
* { | |
color: #000000!important; | |
font-weight:900 !important; | |
border-color: #555555 !important; | |
scrollbar-arrow-color: #CCCCCC !important; | |
scrollbar-base-color: #2266AA !important; | |
scrollbar-shadow-color: #2266AA !important; | |
scrollbar-face-color: #333333 !important; | |
scrollbar-highlight-color: #2266AA !important; | |
scrollbar-dark-shadow-color: #2266AA !important; |