Skip to content

Instantly share code, notes, and snippets.

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>
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;
// 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 {
// 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
void pushToCamera(BuildContext context) async {
final cameras = await availableCameras();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TakePictureScreen(camera: cameras.first),
),
);
}
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'),
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) {
@BoshiLee
BoshiLee / passwordupdateAlert.m
Created June 12, 2019 03:14
passwordupdateAlert
// 網銀密碼升級 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)
{
yourImageView.load(fromURLString: webUrlString, enableAnimation: true, defaultImage: UIImage(named: "defaultImage")!)
private fun setupAdapter() {
this.forecastListAdapter = ForecastListAdapter(this, WeatherService.threeDayForecast)
forecast_List.adapter = this.forecastListAdapter
forecast_List.layoutManager = LinearLayoutManager(this)
}