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
const String testHtml = """ | |
<div> | |
<h1>測試頁面</h1> | |
<p>這是一個 HTML</p> | |
<h2>Pricing</h2> | |
<p>Lorem ipsum <b>dolor</b> sit amet.</p> | |
<h2>The Team</h2> | |
<p>There isn't <i>really</i> a team...</p> | |
<h2>WomenYellsAtCatMeme</h2> | |
<p><img src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/womanyellingcat-1573233850.jpg" width="400" alt="示意圖僅供參考示意1" title="點圖放大" style="cursor: pointer;"></p> |
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
FloatingActionButton( | |
child: Icon(Icons.camera_alt), | |
// Provide an onPressed callback. | |
onPressed: () async { | |
// Take the Picture in a try / catch block. If anything goes wrong, | |
// catch the error. | |
try { | |
// Ensure that the camera is initialized. | |
await _initializeControllerFuture; |
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
// You must wait until the controller is initialized before displaying the | |
// camera preview. Use a FutureBuilder to display a loading spinner until the | |
// controller has finished initializing. | |
FutureBuilder<void>( | |
future: _initializeControllerFuture, | |
builder: (context, snapshot) { | |
if (snapshot.connectionState == ConnectionState.done) { | |
// If the Future is complete, display the preview. | |
return CameraPreview(_controller); | |
} else { |
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
// A screen that takes in a list of cameras and the Directory to store images. | |
class TakePictureScreen extends StatefulWidget { | |
final CameraDescription camera; | |
const TakePictureScreen({ | |
Key key, | |
@required this.camera, | |
}) : super(key: key); | |
@override |
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
void pushToCamera(BuildContext context) async { | |
final cameras = await availableCameras(); | |
Navigator.push( | |
context, | |
MaterialPageRoute( | |
builder: (context) => TakePictureScreen(camera: cameras.first), | |
), | |
); | |
} |
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
class StartTakePictureScreen extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Camera Example'), | |
), | |
body: Center( | |
child: RaisedButton( | |
child: Text('Take A Picture'), |
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
Stream<int> countStream(int max) async* { | |
for (int i = 0; i < max; i++) { | |
yield i; | |
} | |
} | |
Future<int> sumStream(Stream<int> stream) async { | |
int sum = 0; | |
await for (int value in stream) { |
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
// 網銀密碼升級 Alert 文字 | |
NSDate *fourDigisPasswordExpireDate = [@"2019/9/9" dateFromMMBShortStyleDateString]; | |
NSAttributedString *updatePasswordNotifyString = [MMBLoginModel updatePasswordNotifyWithDate:fourDigisPasswordExpireDate]; | |
if ([MMBLoginModel isFourDigiPasswordExpired:fourDigisPasswordExpireDate]) { | |
[MMBViewEngine.sharedInstance showAlert:@"網銀密碼升級" | |
attributedmessage:updatePasswordNotifyString | |
aligment:NSTextAlignmentJustified | |
actionTitles:@[@"立即升級"] callBack:^(NSInteger isConfirm) | |
{ |
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
yourImageView.load(fromURLString: webUrlString, enableAnimation: true, defaultImage: UIImage(named: "defaultImage")!) |
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
private fun setupAdapter() { | |
this.forecastListAdapter = ForecastListAdapter(this, WeatherService.threeDayForecast) | |
forecast_List.adapter = this.forecastListAdapter | |
forecast_List.layoutManager = LinearLayoutManager(this) | |
} |