mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: upgrade flutter to 3.10.1 (#2619)
* chore: upgrade flutter and dart * ci: upgrade flutter in cicd * fix: remove textstyle_extensions from flowy_infra * ci: upgrade flutter in cicd * fix: update flutter.toml * fix: deprecations and ffi * fix: move json_annotation to dependencies Must have accidentally moved it to dev_dependencies when upgrading dependencies * fix: update editor ref and use fold * chore: try with generate true
This commit is contained in:
@ -5,7 +5,7 @@ import 'dart:async';
|
||||
import 'package:dartz/dartz.dart';
|
||||
part 'select_option_type_option_bloc.freezed.dart';
|
||||
|
||||
abstract class ISelectOptionAction {
|
||||
abstract mixin class ISelectOptionAction {
|
||||
Future<List<SelectOptionPB>> Function(String) get insertOption;
|
||||
|
||||
List<SelectOptionPB> Function(SelectOptionPB) get deleteOption;
|
||||
|
@ -17,7 +17,7 @@ abstract class RowFieldsDelegate {
|
||||
void onFieldsChanged(void Function(List<FieldInfo>) callback);
|
||||
}
|
||||
|
||||
abstract class RowCacheDelegate {
|
||||
abstract mixin class RowCacheDelegate {
|
||||
UnmodifiableListView<FieldInfo> get fields;
|
||||
void onRowDispose();
|
||||
}
|
||||
|
@ -17,11 +17,11 @@ class CalendarToolbar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
return const SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: const [
|
||||
children: [
|
||||
_UnscheduleEventsButton(),
|
||||
_SettingButton(),
|
||||
],
|
||||
|
@ -62,9 +62,9 @@ class _AccessoryMenu extends StatelessWidget {
|
||||
color: AFThemeExtension.of(context).toggleOffFill,
|
||||
),
|
||||
const VSpace(6),
|
||||
IntrinsicHeight(
|
||||
const IntrinsicHeight(
|
||||
child: Row(
|
||||
children: const [
|
||||
children: [
|
||||
SortMenu(),
|
||||
HSpace(6),
|
||||
FilterMenu(),
|
||||
|
@ -157,7 +157,7 @@ class EditableRowNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class EditableCell {
|
||||
abstract mixin class EditableCell {
|
||||
// Each cell notifier will be bind to the [EditableRowNotifier], which enable
|
||||
// the row notifier receive its cells event. For example: begin editing the
|
||||
// cell or end editing the cell.
|
||||
|
@ -2,7 +2,6 @@ import 'package:appflowy/plugins/database_view/application/cell/cell_controller_
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:textstyle_extensions/textstyle_extensions.dart';
|
||||
import '../../row/cell_builder.dart';
|
||||
import '../bloc/text_card_cell_bloc.dart';
|
||||
import '../define.dart';
|
||||
@ -178,7 +177,10 @@ class _TextCardCellState extends State<TextCardCell> {
|
||||
onChanged: (value) => focusChanged(),
|
||||
onEditingComplete: () => focusNode.unfocus(),
|
||||
maxLines: null,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.size(_fontSize()),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.copyWith(fontSize: _fontSize()),
|
||||
decoration: InputDecoration(
|
||||
// Magic number 4 makes the textField take up the same space as FlowyText
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
|
@ -2,7 +2,6 @@ import 'package:appflowy/plugins/database_view/application/cell/cell_controller_
|
||||
import 'package:flowy_infra/size.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:textstyle_extensions/textstyle_extensions.dart';
|
||||
|
||||
import '../bloc/url_card_cell_bloc.dart';
|
||||
import '../define.dart';
|
||||
@ -60,12 +59,11 @@ class _URLCardCellState extends State<URLCardCell> {
|
||||
textAlign: TextAlign.left,
|
||||
text: TextSpan(
|
||||
text: state.content,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium!
|
||||
.size(widget.style?.fontSize ?? FontSizes.s14)
|
||||
.textColor(Theme.of(context).colorScheme.primary)
|
||||
.underline,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: widget.style?.fontSize ?? FontSizes.s14,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -6,7 +6,7 @@ enum AccessoryType {
|
||||
more,
|
||||
}
|
||||
|
||||
abstract class CardAccessory implements Widget {
|
||||
abstract mixin class CardAccessory implements Widget {
|
||||
AccessoryType get type;
|
||||
void onTap(BuildContext context) {}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class GridCellAccessoryBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class GridCellAccessoryState {
|
||||
abstract mixin class GridCellAccessoryState {
|
||||
void onTap();
|
||||
|
||||
// The accessory will be hidden if enable() return false;
|
||||
|
@ -17,7 +17,6 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:table_calendar/table_calendar.dart';
|
||||
import 'package:textstyle_extensions/textstyle_extensions.dart';
|
||||
import '../../../../grid/presentation/layout/sizes.dart';
|
||||
import '../../../../grid/presentation/widgets/common/type_option_separator.dart';
|
||||
import '../../../../grid/presentation/widgets/header/type_option/date.dart';
|
||||
@ -198,11 +197,13 @@ class _CellCalendarWidgetState extends State<_CellCalendarWidget> {
|
||||
outsideDecoration: boxDecoration,
|
||||
defaultTextStyle: textStyle,
|
||||
weekendTextStyle: textStyle,
|
||||
selectedTextStyle:
|
||||
textStyle.textColor(Theme.of(context).colorScheme.surface),
|
||||
selectedTextStyle: textStyle.copyWith(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
todayTextStyle: textStyle,
|
||||
outsideTextStyle:
|
||||
textStyle.textColor(Theme.of(context).disabledColor),
|
||||
outsideTextStyle: textStyle.copyWith(
|
||||
color: Theme.of(context).disabledColor,
|
||||
),
|
||||
),
|
||||
selectedDayPredicate: (day) => isSameDay(state.dateTime, day),
|
||||
onDaySelected: (selectedDay, focusedDay) {
|
||||
|
@ -8,7 +8,6 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:textfield_tags/textfield_tags.dart';
|
||||
import 'package:textstyle_extensions/textstyle_extensions.dart';
|
||||
|
||||
import 'extension.dart';
|
||||
|
||||
@ -126,7 +125,7 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
|
||||
hintStyle: Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall!
|
||||
.textColor(Theme.of(context).hintColor),
|
||||
.copyWith(color: Theme.of(context).hintColor),
|
||||
suffixText: _suffixText(),
|
||||
counterText: "",
|
||||
prefixIconConstraints:
|
||||
|
@ -6,7 +6,6 @@ import 'package:appflowy/plugins/document/presentation/editor_style.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
/// Wrapper for the appflowy editor.
|
||||
class AppFlowyEditorPage extends StatefulWidget {
|
||||
@ -88,14 +87,16 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final autoFocusParameters = _computeAutoFocusParameters();
|
||||
final (bool autoFocus, Selection? selection) =
|
||||
_computeAutoFocusParameters();
|
||||
|
||||
final editor = AppFlowyEditor.custom(
|
||||
editorState: widget.editorState,
|
||||
editable: true,
|
||||
scrollController: scrollController,
|
||||
// setup the auto focus parameters
|
||||
autoFocus: autoFocusParameters.item1,
|
||||
focusedSelection: autoFocusParameters.item2,
|
||||
autoFocus: autoFocus,
|
||||
focusedSelection: selection,
|
||||
// setup the theme
|
||||
editorStyle: styleCustomizer.style(),
|
||||
// customize the block builder
|
||||
@ -107,7 +108,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
);
|
||||
|
||||
return Center(
|
||||
child: Container(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: double.infinity,
|
||||
),
|
||||
@ -246,17 +247,17 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
return builders;
|
||||
}
|
||||
|
||||
Tuple2<bool, Selection?> _computeAutoFocusParameters() {
|
||||
(bool, Selection?) _computeAutoFocusParameters() {
|
||||
if (widget.editorState.document.isEmpty) {
|
||||
return Tuple2(true, Selection.collapse([0], 0));
|
||||
return (true, Selection.collapse([0], 0));
|
||||
}
|
||||
final nodes = widget.editorState.document.root.children
|
||||
.where((element) => element.delta != null);
|
||||
final isAllEmpty =
|
||||
nodes.isNotEmpty && nodes.every((element) => element.delta!.isEmpty);
|
||||
if (isAllEmpty) {
|
||||
return Tuple2(true, Selection.collapse(nodes.first.path, 0));
|
||||
return (true, Selection.collapse(nodes.first.path, 0));
|
||||
}
|
||||
return const Tuple2(false, null);
|
||||
return const (false, null);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/base/inser
|
||||
import 'package:appflowy/workspace/application/app/app_service.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart';
|
||||
import 'package:dartz/dartz.dart' as dartz;
|
||||
import 'package:flowy_infra/image.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||
import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
@ -66,16 +65,16 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {
|
||||
EditorStyle get style => widget.editorState.editorStyle;
|
||||
int _selectedIndex = 0;
|
||||
int _totalItems = 0;
|
||||
Future<List<dartz.Tuple2<ViewPB, List<ViewPB>>>>? _availableLayout;
|
||||
final Map<int, dartz.Tuple2<ViewPB, ViewPB>> _items = {};
|
||||
Future<List<(ViewPB, List<ViewPB>)>>? _availableLayout;
|
||||
final Map<int, (ViewPB, ViewPB)> _items = {};
|
||||
|
||||
Future<List<dartz.Tuple2<ViewPB, List<ViewPB>>>> fetchItems() async {
|
||||
Future<List<(ViewPB, List<ViewPB>)>> fetchItems() async {
|
||||
final items = await AppBackendService().fetchViews(widget.layoutType);
|
||||
|
||||
int index = 0;
|
||||
for (final app in items) {
|
||||
for (final view in app.value2) {
|
||||
_items.putIfAbsent(index, () => dartz.Tuple2(app.value1, view));
|
||||
for (final (app, children) in items) {
|
||||
for (final view in children) {
|
||||
_items.putIfAbsent(index, () => (app, view));
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
@ -158,8 +157,8 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {
|
||||
newSelectedIndex %= _totalItems;
|
||||
} else if (event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
widget.onSelected(
|
||||
_items[_selectedIndex]!.value1,
|
||||
_items[_selectedIndex]!.value2,
|
||||
_items[_selectedIndex]!.$1,
|
||||
_items[_selectedIndex]!.$2,
|
||||
);
|
||||
}
|
||||
|
||||
@ -173,15 +172,15 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {
|
||||
Widget _buildListWidget(
|
||||
BuildContext context,
|
||||
int selectedIndex,
|
||||
Future<List<dartz.Tuple2<ViewPB, List<ViewPB>>>>? items,
|
||||
Future<List<(ViewPB, List<ViewPB>)>>? items,
|
||||
) {
|
||||
int index = 0;
|
||||
return FutureBuilder<List<dartz.Tuple2<ViewPB, List<ViewPB>>>>(
|
||||
return FutureBuilder<List<(ViewPB, List<ViewPB>)>>(
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData &&
|
||||
snapshot.connectionState == ConnectionState.done) {
|
||||
final views = snapshot.data;
|
||||
final children = <Widget>[
|
||||
final List<Widget> children = [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: FlowyText.regular(
|
||||
@ -191,18 +190,20 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
if (views != null && views.isNotEmpty) {
|
||||
for (final view in views) {
|
||||
if (view.value2.isNotEmpty) {
|
||||
for (final (view, viewChildren) in views) {
|
||||
if (viewChildren.isNotEmpty) {
|
||||
children.add(
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: FlowyText.regular(
|
||||
view.value1.name,
|
||||
view.name,
|
||||
),
|
||||
),
|
||||
);
|
||||
for (final value in view.value2) {
|
||||
|
||||
for (final value in viewChildren) {
|
||||
children.add(
|
||||
FlowyButton(
|
||||
isSelected: index == _selectedIndex,
|
||||
@ -211,7 +212,7 @@ class _LinkToPageMenuState extends State<LinkToPageMenu> {
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
text: FlowyText.regular(value.name),
|
||||
onTap: () => widget.onSelected(view.value1, value),
|
||||
onTap: () => widget.onSelected(view, value),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -4,7 +4,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
class FontSizeSwitcher extends StatefulWidget {
|
||||
@ -17,10 +16,10 @@ class FontSizeSwitcher extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _FontSizeSwitcherState extends State<FontSizeSwitcher> {
|
||||
final List<Tuple3<String, double, bool>> _fontSizes = [
|
||||
Tuple3(LocaleKeys.moreAction_small.tr(), 14.0, false),
|
||||
Tuple3(LocaleKeys.moreAction_medium.tr(), 18.0, true),
|
||||
Tuple3(LocaleKeys.moreAction_large.tr(), 22.0, false),
|
||||
final List<(String, double, bool)> _fontSizes = [
|
||||
(LocaleKeys.moreAction_small.tr(), 14.0, false),
|
||||
(LocaleKeys.moreAction_medium.tr(), 18.0, true),
|
||||
(LocaleKeys.moreAction_large.tr(), 22.0, false),
|
||||
];
|
||||
|
||||
@override
|
||||
@ -42,9 +41,9 @@ class _FontSizeSwitcherState extends State<FontSizeSwitcher> {
|
||||
),
|
||||
ToggleButtons(
|
||||
isSelected:
|
||||
_fontSizes.map((e) => e.item2 == state.fontSize).toList(),
|
||||
_fontSizes.map((e) => e.$2 == state.fontSize).toList(),
|
||||
onPressed: (int index) {
|
||||
_updateSelectedFontSize(_fontSizes[index].item2);
|
||||
_updateSelectedFontSize(_fontSizes[index].$2);
|
||||
},
|
||||
color: foregroundColor,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||
@ -63,8 +62,8 @@ class _FontSizeSwitcherState extends State<FontSizeSwitcher> {
|
||||
children: _fontSizes
|
||||
.map(
|
||||
(e) => Text(
|
||||
e.item1,
|
||||
style: TextStyle(fontSize: e.item2),
|
||||
e.$1,
|
||||
style: TextStyle(fontSize: e.$2),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
|
Reference in New Issue
Block a user