Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dart.lineLength": 120
}
12 changes: 6 additions & 6 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
include: package:flutter_lints/flutter.yaml

analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
- "**/*.g.dart"
- "**/*.freezed.dart"
language:
strict-inference: true
strong-mode:
Expand All @@ -10,7 +12,5 @@ analyzer:
missing_required_param: error
linter:
rules:
always-specify-types: true
always_declare_return_types: true
prefer-relative-imports: true
avoid_types_on_closure_parameters: false
avoid_print: false
constant_identifier_names: false
4 changes: 3 additions & 1 deletion lib/_spikes/button_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import 'package:flutter_folio/styled_widgets/buttons/styled_buttons.dart';
import 'package:flutter_folio/styled_widgets/styled_spacers.dart';

class ButtonSheet extends StatelessWidget {
const ButtonSheet({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
final underline = BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey)));
const underline = BoxDecoration(border: Border(bottom: BorderSide(color: Colors.grey)));
Widget _center(Widget w) => Container(child: w, height: 100, decoration: underline, alignment: Alignment.center);
return GestureDetector(
onTap: InputUtils.unFocus,
Expand Down
1 change: 1 addition & 0 deletions lib/_spikes/optimized_drag_stack/my_movable_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class BoxTransformData extends ChangeNotifier {
BoxTransformData({this.offset = Offset.zero, this.scale = 1});

@override
// ignore: unnecessary_overrides
void notifyListeners() => super.notifyListeners();
}

Expand Down
5 changes: 4 additions & 1 deletion lib/_spikes/optimized_drag_stack/optimized_drag_stack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ List<BoxTransformData> _boxes = List.generate(

// Create a Stack that will render each Box
class OptimizedDragStack extends StatefulWidget {
const OptimizedDragStack({Key? key}) : super(key: key);

@override
_OptimizedDragStackState createState() => _OptimizedDragStackState();
}
Expand Down Expand Up @@ -44,6 +46,7 @@ class _OptimizedDragStackState extends State<OptimizedDragStack> {
}
}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
Expand Down Expand Up @@ -75,7 +78,7 @@ class _SquareImage extends StatelessWidget {
width: 100 * scale,
height: 100 * scale,
child: Container(
padding: EdgeInsets.all(20),
padding: const EdgeInsets.all(20),
color: RandomColor().randomColor(),
child: CachedNetworkImage(
imageUrl:
Expand Down
11 changes: 6 additions & 5 deletions lib/_spikes/popup_menu_spike/popup_panel_spike.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:flutter_folio/views/editor_page/scrap_popup_editor/animated_menu
import 'package:flutter_folio/views/editor_page/scrap_popup_editor/scrap_popup_editor.dart';

class PopupPanelSpike extends StatefulWidget {
const PopupPanelSpike({Key? key}) : super(key: key);

@override
_PopupPanelSpikeState createState() => _PopupPanelSpikeState();
}
Expand All @@ -30,7 +32,7 @@ class _PopupPanelSpikeState extends State<PopupPanelSpike> {
//Positioned(child: ControlPanel(), left: 100, top: 100),

Transform.translate(
offset: Offset(100, 50),
offset: const Offset(100, 50),
//child: _ExamplePopupPanel(),
child: ScrapPopupEditor(
onRotChanged: (value) {
Expand Down Expand Up @@ -69,7 +71,6 @@ class _ExamplePopupPanelState extends State<_ExamplePopupPanel> {
childBuilder: childBuilder);
}

;
timeDilation = 1;
double row1Height = 60;
double row2Height = 40;
Expand All @@ -96,15 +97,15 @@ class _ExamplePopupPanelState extends State<_ExamplePopupPanel> {
..._sortChildrenWithSelectedOnTop([
/// TOP ROW
animatedPanel(
Offset(0, 0), // Pos(row: 0, item: 0)
const Offset(0, 0), // Pos(row: 0, item: 0)
Size(150, row1Height),
index: 0,
openHeight: 100,
childBuilder: (bool isOpen) => Content("CONTROL-1", Colors.green, isOpen: isOpen),
),

animatedPanel(
Offset(150, 0), // Pos(row: 0, item: 1)
const Offset(150, 0), // Pos(row: 0, item: 1)
Size(150, row1Height),
index: 1,
openHeight: 100,
Expand Down Expand Up @@ -163,7 +164,7 @@ class Content extends StatelessWidget {
key: ValueKey(isOpen),
child: Stack(fit: StackFit.expand, children: [
if (isOpen == false) Text(lbl),
if (isOpen) Center(child: Text(lbl, style: TextStyle(fontSize: 32)))
if (isOpen) Center(child: Text(lbl, style: const TextStyle(fontSize: 32)))
]),
),
);
Expand Down
14 changes: 9 additions & 5 deletions lib/_spikes/tab_bug_repro.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import 'package:flutter/material.dart';

class TabBugRepro extends StatelessWidget {
const TabBugRepro({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
children: [
TextButton(onPressed: () {}, child: Text("btn")),
TextButton(onPressed: () {}, child: const Text("btn")),
Flexible(
child: IndexedStack(
index: 0,
children: [
SomeView(),
const SomeView(),
ExcludeFocus(
excluding: true,
child: FocusTraversalGroup(child: SomeView()),
child: FocusTraversalGroup(child: const SomeView()),
)
],
)),
Expand All @@ -27,11 +29,13 @@ class TabBugRepro extends StatelessWidget {
}

class SomeView extends StatelessWidget {
const SomeView({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Row(children: [
TextButton(onPressed: () {}, child: Text("FOO")),
TextButton(onPressed: () {}, child: Text("BAR")),
TextButton(onPressed: () {}, child: const Text("FOO")),
TextButton(onPressed: () {}, child: const Text("BAR")),
]);
}
}
2 changes: 1 addition & 1 deletion lib/_utils/context_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ContextUtils {
} catch (e) {
print(e);
}
return Size(1, 1);
return const Size(1, 1);
}

static Offset localToGlobal(BuildContext c, {Offset local = Offset.zero}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/_utils/file_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ class FileUtils {
} catch (e) {
print("$e");
}
return null;
return;
}
}
2 changes: 1 addition & 1 deletion lib/_utils/native_window_utils/macos_window_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:math';
import 'package:flutter/services.dart';

class MacosWindowUtils {
static const methodChannel = const MethodChannel("flutterfolio.com/io");
static const methodChannel = MethodChannel("flutterfolio.com/io");
static const kMinTitlebarHeight = 24.0;
static const kDefaultTitlebarHeight = 24.0;
static double _calculatedTitlebarHeight = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class LinuxCloseButton extends _LinuxWindowButton {

Widget _linuxWindowButtonBuilder(WindowButtonContext context, Widget icon) {
return Container(
margin: EdgeInsets.all(5),
margin: const EdgeInsets.all(5),
decoration: ShapeDecoration(
shape: CircleBorder(),
shape: const CircleBorder(),
color: context.backgroundColor,
),
child: icon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const _linuxCloseIconSvg = """
""";

class LinuxMinimizeIcon extends StatelessWidget {
const LinuxMinimizeIcon({required this.color});
const LinuxMinimizeIcon({required this.color, Key? key}) : super(key: key);

final Color color;

Expand All @@ -40,7 +40,7 @@ class LinuxMinimizeIcon extends StatelessWidget {
}

class LinuxMaximizeIcon extends StatelessWidget {
const LinuxMaximizeIcon({required this.color});
const LinuxMaximizeIcon({required this.color, Key? key}) : super(key: key);

final Color color;

Expand All @@ -51,7 +51,7 @@ class LinuxMaximizeIcon extends StatelessWidget {
}

class LinuxUnmaximizeIcon extends StatelessWidget {
const LinuxUnmaximizeIcon({required this.color});
const LinuxUnmaximizeIcon({required this.color, Key? key}) : super(key: key);

final Color color;

Expand All @@ -62,7 +62,7 @@ class LinuxUnmaximizeIcon extends StatelessWidget {
}

class LinuxCloseIcon extends StatelessWidget {
const LinuxCloseIcon({required this.color});
const LinuxCloseIcon({required this.color, Key? key}) : super(key: key);

final Color color;

Expand Down
6 changes: 4 additions & 2 deletions lib/_utils/native_window_utils/window_utils_native.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ IoUtils _instance = IoUtilsNative();
IoUtils getInstance() => _instance;

class IoUtilsNative implements IoUtils {
IoUtilsNative() {}
IoUtilsNative();

@override
void showWindowWhenReady() {
if (Platform.isWindows == false) return;
doWhenWindowReady(() {
// Apply min-window size, allow a smaller size when developing for easier responsive testing.
appWindow.minSize = kReleaseMode ? Size(800, 600) : Size(300, 400);
appWindow.minSize = kReleaseMode ? const Size(800, 600) : const Size(300, 400);
appWindow.show();
});
}

@override
Widget wrapNativeTitleBarIfRequired(Widget child) {
if (DeviceOS.isWindows) {
return WindowsTitleBar(child);
Expand Down
2 changes: 2 additions & 0 deletions lib/_utils/native_window_utils/window_utils_no_op.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ IoUtils _instance = IoUtilsNoOp();
IoUtils getInstance() => _instance;

class IoUtilsNoOp implements IoUtils {
@override
void showWindowWhenReady() {}
@override
Widget wrapNativeTitleBarIfRequired(Widget child) => child;
void setMinSize(Size size) {}

Expand Down
4 changes: 2 additions & 2 deletions lib/_utils/path_utils.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'dart:io';

import 'package:path_provider/path_provider.dart';
import 'package:xdg_directories/xdg_directories.dart' as xdgDirectories;
import 'package:xdg_directories/xdg_directories.dart' as xdg_directories;

class PathUtil {
static Future<String?> get dataPath async {
String? result;
if (Platform.isLinux) {
result = "${xdgDirectories.dataHome.path}/flutterfolio";
result = "${xdg_directories.dataHome.path}/flutterfolio";
} else {
try {
return (await getApplicationSupportDirectory()).path;
Expand Down
4 changes: 2 additions & 2 deletions lib/_utils/string_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class StringUtils {

// Measures text using an off-screen canvas. It's not fast, but not overly slow either. Use with (mild) caution :)
static Size measure(String text, TextStyle style,
{int maxLines: 1, TextDirection direction = TextDirection.ltr, double maxWidth = double.infinity}) {
{int maxLines = 1, TextDirection direction = TextDirection.ltr, double maxWidth = double.infinity}) {
final TextPainter textPainter =
TextPainter(text: TextSpan(text: text, style: style), maxLines: maxLines, textDirection: direction)
..layout(minWidth: 0, maxWidth: maxWidth);
return textPainter.size;
}

// Measures longest text item in a list of Strings. Useful for things like Dropdown Menu, where you just want to take up as much space as the content requires.
static double measureLongest(List<String> items, TextStyle style, [int? maxItems = null]) {
static double measureLongest(List<String> items, TextStyle style, [int? maxItems]) {
double l = 0;
if (maxItems != null && maxItems < items.length) {
items.length = maxItems;
Expand Down
6 changes: 3 additions & 3 deletions lib/_utils/universal_file/io_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class IoFileWriter implements UniversalFile {
Future<String?> read() async {
await getDataPath();
print("Loading file @ $fullPath");
if (await File("$fullPath").exists()) {
return await File("$fullPath").readAsString().catchError((Object e) {
if (await File(fullPath).exists()) {
return await File(fullPath).readAsString().catchError((Object e) {
log(e.toString());
});
}
Expand All @@ -45,7 +45,7 @@ class IoFileWriter implements UniversalFile {
print("[IoFileWriter] Writing file to: $fullPath");
try {
FileMode writeMode = append ? FileMode.append : FileMode.write;
File("$fullPath").writeAsString(value, mode: writeMode);
File(fullPath).writeAsString(value, mode: writeMode);
} catch (e) {
print("$e");
}
Expand Down
6 changes: 4 additions & 2 deletions lib/_widgets/animated/animated_fractional_offset.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import 'package:flutter/material.dart';

class AnimatedFractionalOffset extends StatelessWidget {
AnimatedFractionalOffset({
const AnimatedFractionalOffset({
required this.child,
required this.duration,
this.begin,
required this.end,
this.curve = Curves.easeOut,
});
Key? key,
}) : super(key: key);
final Widget child;
final Duration duration;
final Offset? begin;
final Offset end;
final Curve curve;

@override
Widget build(BuildContext context) {
return TweenAnimationBuilder<Offset>(
duration: duration,
Expand Down
6 changes: 4 additions & 2 deletions lib/_widgets/animated/animated_offset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import 'package:flutter/material.dart';
import 'package:flutter_folio/_widgets/alignments.dart';

class AnimatedOffset extends StatelessWidget {
AnimatedOffset({
const AnimatedOffset({
required this.child,
required this.duration,
this.begin,
required this.end,
this.curve = Curves.easeOut,
});
Key? key,
}) : super(key: key);
final Widget child;
final Duration duration;
final Offset? begin;
final Offset end;
final Curve curve;

@override
Widget build(BuildContext context) {
return TweenAnimationBuilder<Offset>(
duration: duration,
Expand Down
Loading