Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
feat: use black_hole_flutter
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasWanke committed Mar 19, 2020
1 parent e362f12 commit ee9999b
Showing 10 changed files with 61 additions and 26 deletions.
5 changes: 3 additions & 2 deletions lib/choose_directory_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

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

import 'editor_page.dart';
@@ -39,7 +40,7 @@ class ChooseDirectoryPage extends StatelessWidget {
),
SizedBox(width: 16),
RaisedButton(
color: Theme.of(context).primaryColor,
color: context.theme.primaryColor,
onPressed: () {
final isValid = _formKey.currentState.validate();
if (!isValid) {
@@ -53,7 +54,7 @@ class ChooseDirectoryPage extends StatelessWidget {
child: Text(
'Open',
style: TextStyle(
color: Theme.of(context).primaryTextTheme.button.color,
color: context.theme.primaryTextTheme.button.color,
),
),
),
7 changes: 4 additions & 3 deletions lib/editor_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:l42n/new_resource_fab.dart';
@@ -143,9 +144,9 @@ class TopDashboard extends StatelessWidget {
return Text(
'L42n',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline4.copyWith(
color: Theme.of(context).primaryColor,
),
style: context.textTheme.headline4.copyWith(
color: context.theme.primaryColor,
),
);
}
}
5 changes: 3 additions & 2 deletions lib/id_with_highlighted_parts.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:flutter/material.dart';

class IdWithHighlightedParts extends StatelessWidget {
IdWithHighlightedParts({
const IdWithHighlightedParts({
@required this.id,
this.partsToHighlight = const [],
}) : assert(id != null),
@@ -55,7 +56,7 @@ class IdWithHighlightedParts extends StatelessWidget {

final normalStyle = DefaultTextStyle.of(context).style;
final highlightStyle = normalStyle.copyWith(
backgroundColor: Theme.of(context).primaryColor.withOpacity(0.3),
backgroundColor: context.theme.primaryColor.withOpacity(0.3),
);

return RichText(
5 changes: 3 additions & 2 deletions lib/new_resource_fab.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

@@ -78,7 +79,7 @@ class _NewResourceFabState extends State<NewResourceFab> {
child: InkWell(
borderRadius: _borderRadius,
onTap: _open,
child: Icon(Icons.add, color: Theme.of(context).primaryColor),
child: Icon(Icons.add, color: context.theme.primaryColor),
),
);
}
@@ -100,7 +101,7 @@ class _NewResourceFabState extends State<NewResourceFab> {
),
// child: InkWell(
// onTap: () => setState(() => _isOpen = false),
// child: Icon(Icons.add, color: Theme.of(context).primaryColor),
// child: Icon(Icons.add, color: context.theme.primaryColor),
// ),
);
}
5 changes: 3 additions & 2 deletions lib/search_bar.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:flutter/material.dart';

@immutable
@@ -10,7 +11,7 @@ class SearchSuggestion {

/// The whole search bar, including suggestions.
class SearchBar extends StatefulWidget {
SearchBar({@required this.onChanged, this.suggestions = const []})
const SearchBar({@required this.onChanged, this.suggestions = const []})
: assert(onChanged != null, suggestions != null);

final void Function(String) onChanged;
@@ -113,7 +114,7 @@ class _SearchChip extends StatelessWidget {
label: Text(text),
elevation: 2,
pressElevation: 6,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
backgroundColor: context.theme.scaffoldBackgroundColor,
onPressed: onTap,
);
}
5 changes: 3 additions & 2 deletions lib/translation_field.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

@@ -120,8 +121,8 @@ class _EditableTranslationFieldState extends State<EditableTranslationField> {
scrollPadding: EdgeInsets.symmetric(vertical: 100),
minLines: 1,
maxLines: null,
style: Theme.of(context).textTheme.bodyText1,
cursorColor: Theme.of(context).primaryColor,
style: context.textTheme.bodyText1,
cursorColor: context.theme.primaryColor,
backgroundCursorColor: Colors.green,
cursorOpacityAnimates: true,
cursorRadius: Radius.circular(1),
7 changes: 3 additions & 4 deletions lib/translation_grid.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sticky_header/flutter_sticky_header.dart';
import 'package:l42n/id_with_highlighted_parts.dart';
import 'package:provider/provider.dart';

import 'data/data.dart';
import 'translation_field.dart';
import 'translation_row.dart';

class TranslationGrid extends StatelessWidget {
@@ -37,7 +36,7 @@ class TranslationGrid extends StatelessWidget {
];
return SliverStickyHeaderBuilder(
builder: (context, state) => Material(
color: Theme.of(context).colorScheme.surface,
color: context.theme.colorScheme.surface,
elevation: state.isPinned ? 4 : 0,
child: _HeaderRow(proportions: proportions),
),
@@ -99,7 +98,7 @@ class _HeaderRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
final project = Provider.of<Project>(context);
final textStyle = Theme.of(context).textTheme.subtitle1;
final textStyle = context.textTheme.subtitle1;

return StreamBuilder<List<Locale>>(
stream: project.localeBloc.all,
9 changes: 5 additions & 4 deletions lib/translation_row.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:black_hole_flutter/black_hole_flutter.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

@@ -61,8 +62,8 @@ class _TranslationRowState extends State<TranslationRow> {
child: Material(
animationDuration: _animationDuration,
color: Color.lerp(
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).primaryColor,
context.theme.scaffoldBackgroundColor,
context.theme.primaryColor,
_isFocused ? 0.05 : 0.0,
),
elevation: _isFocused ? 4 : 0,
@@ -183,7 +184,7 @@ class ErrorDot extends StatelessWidget {
decoration: BoxDecoration(
shape: BoxShape.circle,
color: errors.any((e) => e.severity == ErrorSeverity.error)
? Theme.of(context).errorColor
? context.theme.errorColor
: Colors.yellow,
),
width: 12,
@@ -203,7 +204,7 @@ class ErrorList extends StatelessWidget {
Widget build(BuildContext context) {
return Material(
borderRadius: BorderRadius.circular(8),
color: Theme.of(context).errorColor.withOpacity(0.1),
color: context.theme.errorColor.withOpacity(0.1),
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(8),
38 changes: 33 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -43,13 +43,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
black_hole_flutter:
dependency: "direct main"
description:
name: black_hole_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.1"
charcode:
dependency: transitive
description:
@@ -85,6 +99,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
dartx:
dependency: transitive
description:
name: dartx
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
flutter:
dependency: "direct main"
description: flutter
@@ -108,7 +129,7 @@ packages:
name: get_it
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
glob:
dependency: transitive
description:
@@ -178,7 +199,7 @@ packages:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.1"
version: "1.9.2"
path:
dependency: "direct main"
description:
@@ -192,7 +213,7 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
version: "1.9.0"
petitparser:
dependency: transitive
description:
@@ -213,7 +234,7 @@ packages:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.3"
version: "1.4.4"
quiver:
dependency: transitive
description:
@@ -289,6 +310,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
time:
dependency: transitive
description:
name: time
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
tuple:
dependency: "direct main"
description:
@@ -316,7 +344,7 @@ packages:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+13"
version: "0.9.7+14"
xml:
dependency: transitive
description:
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ dependencies:

analyzer: ^0.39.4
animations: ^1.0.0+5
black_hole_flutter: ^0.1.0
flutter_sticky_header: ^0.4.2
get_it: ^4.0.0
meta: ^1.1.8

0 comments on commit ee9999b

Please sign in to comment.