-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implemented zoom level customization
Also completed the following tasks: - Fixed some issues and refactored the title and toolbar - Added more tests
- Loading branch information
Showing
28 changed files
with
907 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export 'platform/platform.dart'; | ||
export 'widgets/widgets.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// coverage:ignore-file | ||
// ignore_for_file: public_member_api_docs | ||
|
||
import 'universal_platform_web.dart' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// coverage:ignore-file | ||
// ignore_for_file: public_member_api_docs | ||
|
||
import 'dart:io'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// {@template child_wrapper} | ||
/// Wraps a [child] widget when a given [shouldWrap] condition is true. | ||
/// Otherwise, it will return the child widget itself. | ||
/// {@endtemplate} | ||
class ChildWrapper extends StatelessWidget { | ||
/// A child widget that will wrapped if [shouldWrap] is true. | ||
final Widget child; | ||
|
||
/// Defines whether the [child] widget should be wrapped with [wrap]. | ||
final bool shouldWrap; | ||
|
||
/// A callback that will wrap a [child] widget when [shouldWrap] is true; | ||
final Widget Function(Widget child) wrap; | ||
|
||
/// {@macro child_wrapper} | ||
const ChildWrapper({ | ||
Key? key, | ||
required this.wrap, | ||
required this.child, | ||
required this.shouldWrap, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) => shouldWrap ? wrap(child) : child; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'child_wrapper.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'widgets/widgets.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../../helpers/helpers.dart'; | ||
import '../../l10n/l10n.dart'; | ||
import '../titlebar.dart'; | ||
|
||
const _kTitleBarHeight = 38.0; | ||
|
||
/// {@template title_bar} | ||
/// Shows a window title bar. | ||
/// | ||
/// It is a replacement of the native title bar widget on desktop. And will be | ||
/// shown as an app bar on web. | ||
/// {@endtemplate} | ||
class TitleBar extends StatelessWidget { | ||
/// {@macro title_bar} | ||
const TitleBar({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final isMacosDesktop = !pIsWeb && pIsMacOS; | ||
return Container( | ||
width: double.infinity, | ||
height: _kTitleBarHeight, | ||
color: const Color(0XFFF7F7F7), | ||
child: Padding( | ||
padding: EdgeInsets.only(left: isMacosDesktop ? 70 : 8, right: 8), | ||
child: Row( | ||
children: const [ | ||
Expanded(child: _TitleBarLeading()), | ||
_AppTitle(), | ||
Expanded(child: _TitleBarAction()), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class _AppTitle extends StatelessWidget { | ||
const _AppTitle({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
return Center( | ||
child: Text( | ||
l10n.appName, | ||
style: const TextStyle(color: Color(0xFF616161)), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class _TitleBarAction extends StatelessWidget { | ||
const _TitleBarAction({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.end, | ||
children: const [ | ||
ZoomLevelInputField(), | ||
], | ||
); | ||
} | ||
} | ||
|
||
class _TitleBarLeading extends StatelessWidget { | ||
const _TitleBarLeading({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: const [ | ||
Padding( | ||
padding: EdgeInsets.only(left: 12, right: 8), | ||
child: Icon(Icons.home_rounded, size: 20), | ||
), | ||
TitleBarTab(), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
||
import '../../l10n/l10n.dart'; | ||
import '../../toolbar/toolbar.dart'; | ||
|
||
/// {@template} | ||
/// A tab bar shown to select the [BoardViewType]. | ||
/// {@endtemplate} | ||
class TitleBarTab extends StatelessWidget { | ||
/// {@macro toolbar_tab} | ||
const TitleBarTab({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
void onTabSelected(int value) { | ||
final viewType = BoardViewType.values.elementAt(value); | ||
final event = ToolbarEvent.boardViewTypeSelected(viewType); | ||
context.read<ToolbarBloc>().add(event); | ||
} | ||
|
||
return DefaultTabController( | ||
length: 2, | ||
child: TabBar( | ||
isScrollable: true, | ||
onTap: onTabSelected, | ||
tabs: BoardViewType.values | ||
.map((type) => Tab(text: l10n.boardViewTypeLabel(type.name))) | ||
.toList(), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export 'titlebar.dart'; | ||
export 'titlebar_tab_bar.dart'; | ||
export 'zoom_level_input_field.dart'; |
Oops, something went wrong.