Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions experimental/desktop_photo_search/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:provider/provider.dart';

import 'src/model/photo_search_model.dart';
import 'src/unsplash/unsplash.dart';
import 'src/widgets/about_dialog.dart';
import 'src/widgets/photo_details.dart';
import 'src/widgets/photo_search_dialog.dart';
import 'src/widgets/split.dart';
Expand Down Expand Up @@ -75,6 +76,17 @@ class UnsplashHomePage extends StatelessWidget {
);
},
),
]),
menubar.Submenu(label: 'About', children: [
menubar.MenuItem(
label: 'About ...',
onClicked: () {
showDialog<void>(
context: context,
builder: (context) => PolicyDialog(),
);
},
),
])
]);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart' as url_launcher;

class PolicyDialog extends StatelessWidget {
PolicyDialog({
Key key,
this.radius = 8,
}) : super(key: key);

final double radius;

@override
Widget build(BuildContext context) {
return AlertDialog(
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius)),
content: Builder(
builder: (context) {
var height = MediaQuery.of(context).size.height;
var width = MediaQuery.of(context).size.width;
return Container(
height: height / 4,
width: width / 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: 'Terms & Conditions:\n',
style: Theme.of(context).textTheme.headline5,
),
),
RichText(
textAlign: TextAlign.left,
text: TextSpan(
text: '• ',
style: TextStyle(color: Colors.black, fontSize: 18),
children: <TextSpan>[
TextSpan(
text: 'https://policies.google.com/terms',
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.lightBlue),
recognizer: TapGestureRecognizer()
..onTap = () async {
final url = 'https://policies.google.com/terms';
if (await url_launcher.canLaunch(url)) {
await url_launcher.launch(url);
}
},
)
],
),
),
RichText(
textAlign: TextAlign.left,
text: TextSpan(
text: '• ',
style: TextStyle(color: Colors.black, fontSize: 18),
children: <TextSpan>[
TextSpan(
text: 'https://unsplash.com/terms',
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.lightBlue),
recognizer: TapGestureRecognizer()
..onTap = () async {
final url = 'https://unsplash.com/terms';
if (await url_launcher.canLaunch(url)) {
await url_launcher.launch(url);
}
},
)
],
),
),
],
),
);
},
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(
'CLOSE'.toUpperCase(),
style: TextStyle(fontSize: 20),
),
),
],
);
}
}
2 changes: 1 addition & 1 deletion experimental/desktop_photo_search/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -739,4 +739,4 @@ packages:
version: "2.2.1"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.22.0 <2.0.0"
flutter: ">=1.22.0"
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ add_custom_command(
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
Expand Down