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
enum Books: String { | |
case computer = "Computer" | |
case science = "Science" | |
case langugae = "Language" | |
} |
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
let error : Error = .fatal(num: 404, message: "not found") |
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) | |
} |
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
// 網銀密碼升級 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
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
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
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
// 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
// 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 { |
OlderNewer