Skip to content

Commit

Permalink
Camera Plugin: ran text formating.
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinleguennec committed Apr 12, 2018
1 parent cfa239d commit b182cc9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 32 deletions.
Binary file modified packages/camera/example/ios/Flutter/app.flx
Binary file not shown.
18 changes: 1 addition & 17 deletions packages/camera/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
FE224661708E6DA2A0F8B952 /* [CP] Embed Pods Frameworks */,
EACF0929FF12B6CC70C2D6BE /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -269,29 +268,14 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
EACF0929FF12B6CC70C2D6BE /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
FE224661708E6DA2A0F8B952 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../../../../../../flutter/bin/cache/artifacts/engine/ios-release/Flutter.framework",
"${PODS_ROOT}/../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
Expand Down
29 changes: 14 additions & 15 deletions packages/camera/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome> {

final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();


@override
Widget build(BuildContext context) {
final List<Widget> controlsChildren = <Widget>[];
Expand Down Expand Up @@ -74,9 +73,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome> {

// Depending on controller state display a message or the camera preview.
if (controller == null || !controller.value.isInitialized) {
previewChildren.add(new Text(
previewChildren.add(const Text(
'Tap a camera',
style: new TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 24.0,
fontWeight: FontWeight.w900,
Expand All @@ -102,9 +101,9 @@ class _CameraExampleHomeState extends State<CameraExampleHome> {

// The main scaffolding of the app.
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: const Text('Camera example'),
key: _scaffoldKey,
appBar: new AppBar(
title: const Text('Camera example'),
),
body: new Column(children: <Widget>[
new Container(
Expand All @@ -123,14 +122,13 @@ class _CameraExampleHomeState extends State<CameraExampleHome> {
decoration: new BoxDecoration(
color: Colors.black,
border: new Border.all(
color: controller != null &&
controller.value.isRecordingVideo
? Colors.redAccent : Colors.grey,
color: controller != null && controller.value.isRecordingVideo
? Colors.redAccent
: Colors.grey,
width: 3.0,
),
),
),

new Padding(
padding: const EdgeInsets.all(5.0),
child: new Row(
Expand All @@ -148,23 +146,23 @@ class _CameraExampleHomeState extends State<CameraExampleHome> {
mainAxisSize: MainAxisSize.max,
children: <Widget>[
new IconButton(
icon: new Icon(Icons.camera_alt),
icon: const Icon(Icons.camera_alt),
color: Colors.blue,
onPressed: controller.value.isInitialized &&
!controller.value.isRecordingVideo
? onTakePictureButtonPressed
: null,
),
new IconButton(
icon: new Icon(Icons.videocam),
icon: const Icon(Icons.videocam),
color: Colors.blue,
onPressed: controller.value.isInitialized &&
!controller.value.isRecordingVideo
? onVideoRecordButtonPressed
: null,
),
new IconButton(
icon: new Icon(Icons.stop),
icon: const Icon(Icons.stop),
color: Colors.red,
onPressed: controller.value.isInitialized &&
controller.value.isRecordingVideo
Expand Down Expand Up @@ -199,7 +197,8 @@ class _CameraExampleHomeState extends State<CameraExampleHome> {
String timestamp() => new DateTime.now().millisecondsSinceEpoch.toString();

void showInSnackBar(String message) {
_scaffoldKey.currentState.showSnackBar(new SnackBar(content: new Text(message)));
_scaffoldKey.currentState
.showSnackBar(new SnackBar(content: new Text(message)));
}

void onNewCameraSelected(CameraDescription cameraDescription) async {
Expand All @@ -211,7 +210,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome> {
// If the controller is updated then update the UI.
controller.addListener(() {
if (mounted) setState(() {});
if(controller.value.hasError) {
if (controller.value.hasError) {
showInSnackBar('Camera error ${controller.value.errorDescription}');
}
});
Expand Down

0 comments on commit b182cc9

Please sign in to comment.