[ Fixed Issue #667 ] Add Google and Unsplash terms links to experimental/desktop_photo_search (#678)

pull/679/head
Satyam Goyal 5 years ago committed by GitHub
parent 9b631a2184
commit 192dc62b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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';
@ -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(),
);
},
),
])
]);

@ -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),
),
),
],
);
}
}

@ -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"

@ -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}"

Loading…
Cancel
Save