Skip to content

Commit

Permalink
Project import generated by Copybara. (#2)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 213903300
Change-Id: I772ebe60361eb97c1ca44f6b2d578330f91fefcc
  • Loading branch information
DaveShuckerow authored Sep 21, 2018
1 parent cccc818 commit abc4781
Show file tree
Hide file tree
Showing 19 changed files with 1,655 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Dart template
# Don’t commit the following directories created by pub.
.buildlog
.dart_tool
.pub/
build/
packages
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 0.1.0

Initial release featuring:

* html_widget: Limited support for rendering HTML as flutter widgets.
currently supports the following tags:
*div - br - table - b - u - a - font - hr - text*

* tagged_text: Support for styling text using custom HTML-like tags. This is
particularly useful for styling text within a translated string.
10 changes: 4 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ To send us a pull request:
Please make sure all your checkins have detailed commit messages explaining the patch.

Once you've gotten an LGTM from a project maintainer and once your PR has received
the green light from all our automated testing (Travis, Appveyor, etc), submit your
changes to the `master` branch using one of the following methods:

* Wait for one of the project maintainers to submit it for you.
* Click the green "Merge pull request" button on the GitHub UI of your pull
request (requires commit access).
the green light from all our automated testing (Travis, Appveyor, etc), one of the
project maintainers will merge the changes using a tool to sync with our internal
flutter widgets repo. The PR will automatically be closed when the changes are
merged externally.

You must complete the
[Contributor License Agreement](https://cla.developers.google.com/clas).
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2017 Google, Inc. All rights reserved.
Copyright 2018 the Dart project authors, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Expand Down
5 changes: 0 additions & 5 deletions .analysis_options → analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
analyzer:
strong-mode: true
language:
enableStrictCallChecks: true
enableSuperMixins: true
errors:
# treat missing required parameters as a warning (not a hint)
Expand Down Expand Up @@ -34,7 +32,6 @@ linter:

# === style rules ===
- always_declare_return_types
- always_specify_types
- annotate_overrides
# TODO - avoid_as
- avoid_init_to_null
Expand All @@ -55,15 +52,13 @@ linter:
- package_api_docs
- package_prefixed_library_names
- prefer_is_not_empty
- public_member_api_docs
- slash_for_doc_comments
- sort_constructors_first
- sort_unnamed_constructors_first
- super_goes_last
- type_annotate_public_apis
- type_init_formals
# TODO - unawaited_futures (https://github.com/dart-lang/linter/issues/419)
- unnecessary_brace_in_string_interp
- unnecessary_getters_setters

# === pub rules ===
Expand Down
83 changes: 83 additions & 0 deletions gallery/lib/gallery.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright 2018 the Dart project authors.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
import 'package:gallery/src/tagged_text_page.dart';
import 'package:gallery/src/html_widget_page.dart' as html_latency;

/// Router to all widgets inside the gallery app.
///
/// The app will start with a list showing the `title` field of each
/// [_GalleryPage] in `pages`. Tapping into an item will build the
/// `pageBuilder` for that page on a new route.
class Gallery extends StatefulWidget {
final List<_GalleryPage> pages = <_GalleryPage>[]
..addAll(_GalleryPage.fromMap(html_latency.nameToTestData))
..add(new _GalleryPage(
title: 'Tagged Text',
pageBuilder: (context) => new TaggedTextPage(),
));

@override
State<StatefulWidget> createState() {
return new _GalleryState();
}
}

class _GalleryState extends State<Gallery> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Widgets by Google',
home: new Scaffold(
appBar: new AppBar(title: new Text('Flutter Widgets by Google')),
body: new Builder(builder: (context) => _buildWidgetList(context)),
),
);
}

Widget _buildWidgetList(BuildContext context) {
return new ListView.builder(
itemBuilder: (context, i) {
return new ListTile(
title: new Text(widget.pages[i].title),
onTap: () {
Navigator.of(context).push(new MaterialPageRoute<Null>(
builder: widget.pages[i].pageBuilder));
},
);
},
itemCount: widget.pages.length,
);
}
}

/// Wrapper leading to each page of the gallery app.
///
/// Each instance showcases a single widget's functionality. `title` is the
/// title shown in the top-level view of the app. `pageBuilder` is a
/// [WidgetBuilder] that creates the content to show in that page of the app.
///
/// Note that this is a plain-old Dart object, not a widget. It defines data
/// that the [Gallery] uses to create widgets, one for the entry at the top
/// level list in the app and another for the detail view in each widget's
/// demo page.
class _GalleryPage {
final String title;
final WidgetBuilder pageBuilder;

_GalleryPage({@required this.title, @required this.pageBuilder}) {
assert(title != null);
assert(pageBuilder != null);
}

static Iterable<_GalleryPage> fromMap(
Map<String, WidgetBuilder> nameToTestData) {
return nameToTestData.keys.map((key) =>
new _GalleryPage(title: key, pageBuilder: nameToTestData[key]));
}
}
12 changes: 12 additions & 0 deletions gallery/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2018 the Dart project authors.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:flutter/material.dart';
import 'package:gallery/gallery.dart';

void main() {
runApp(new Gallery());
}
Loading

0 comments on commit abc4781

Please sign in to comment.