Skip to content

Commit

Permalink
format: dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
IldySilva committed Sep 17, 2024
1 parent de7e381 commit 1405a82
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions pkgs/dartpad_ui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,17 @@ class DartPadMainPage extends StatefulWidget {
State<DartPadMainPage> createState() => _DartPadMainPageState();
}

class _DartPadMainPageState extends State<DartPadMainPage> with SingleTickerProviderStateMixin {
class _DartPadMainPageState extends State<DartPadMainPage>
with SingleTickerProviderStateMixin {
late final AppModel appModel;
late final AppServices appServices;
late final SplitViewController mainSplitter;
late final TabController tabController;

final ValueKey<String> _executionWidgetKey = const ValueKey('execution-widget');
final ValueKey<String> _loadingOverlayKey = const ValueKey('loading-overlay-widget');
final ValueKey<String> _executionWidgetKey =
const ValueKey('execution-widget');
final ValueKey<String> _loadingOverlayKey =
const ValueKey('loading-overlay-widget');
final ValueKey<String> _editorKey = const ValueKey('editor');
final ValueKey<String> _consoleKey = const ValueKey('console');
final ValueKey<String> _tabBarKey = const ValueKey('tab-bar');
Expand All @@ -256,12 +259,15 @@ class _DartPadMainPageState extends State<DartPadMainPage> with SingleTickerProv
);

final leftPanelSize = widget.embedMode ? 0.62 : 0.50;
mainSplitter = SplitViewController(weights: [leftPanelSize, 1.0 - leftPanelSize])
..addListener(() {
appModel.splitDragStateManager.handleSplitChanged();
});
mainSplitter =
SplitViewController(weights: [leftPanelSize, 1.0 - leftPanelSize])
..addListener(() {
appModel.splitDragStateManager.handleSplitChanged();
});

final channel = widget.initialChannel != null ? Channel.forName(widget.initialChannel!) : null;
final channel = widget.initialChannel != null
? Channel.forName(widget.initialChannel!)
: null;

appModel = AppModel();
appServices = AppServices(
Expand Down Expand Up @@ -342,7 +348,8 @@ class _DartPadMainPageState extends State<DartPadMainPage> with SingleTickerProv
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final domHeight = mode.calcDomHeight(constraints.maxHeight);
final consoleHeight = mode.calcConsoleHeight(constraints.maxHeight);
final consoleHeight =
mode.calcConsoleHeight(constraints.maxHeight);

return Column(
children: [
Expand Down Expand Up @@ -390,7 +397,8 @@ class _DartPadMainPageState extends State<DartPadMainPage> with SingleTickerProv
],
),
),
if (!widget.embedMode) const StatusLineWidget(mobileVersion: true),
if (!widget.embedMode)
const StatusLineWidget(mobileVersion: true),
],
),
);
Expand Down Expand Up @@ -571,7 +579,9 @@ class DartPadAppBar extends StatelessWidget implements PreferredSizeWidget {
children: [
const Logo(width: 32, type: 'dart'),
const SizedBox(width: denseSpacing),
Text(appName, style: TextStyle(color: Theme.of(context).colorScheme.onSurface)),
Text(appName,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface)),
// Hide new snippet buttons when the screen width is too small.
if (constraints.maxWidth > smallScreenWidth) ...[
const SizedBox(width: defaultSpacing * 4),
Expand Down Expand Up @@ -619,7 +629,9 @@ class DartPadAppBar extends StatelessWidget implements PreferredSizeWidget {

@override
// kToolbarHeight is set to 56.0 in the framework.
Size get preferredSize => bottom == null ? const Size(double.infinity, 56.0) : const Size(double.infinity, 112.0);
Size get preferredSize => bottom == null
? const Size(double.infinity, 56.0)
: const Size(double.infinity, 112.0);

Future<void> _openInIDX() async {
final code = appModel.sourceCodeController.text;
Expand Down Expand Up @@ -677,7 +689,8 @@ class EditorWithButtons extends StatelessWidget {
icon: Icons.help_outline,
tooltip: 'Show docs',
// small: true,
onPressed: value ? null : () => _showDocs(context),
onPressed:
value ? null : () => _showDocs(context),
),
);
},
Expand Down Expand Up @@ -995,7 +1008,8 @@ class ListSamplesWidget extends StatelessWidget {

List<Widget> _buildMenuItems(BuildContext context) {
final menuItems = [
for (final MapEntry(key: category, value: samples) in Samples.categories.entries) ...[
for (final MapEntry(key: category, value: samples)
in Samples.categories.entries) ...[
MenuItemButton(
onPressed: null,
child: Text(
Expand All @@ -1006,7 +1020,8 @@ class ListSamplesWidget extends StatelessWidget {
for (final sample in samples)
MenuItemButton(
leadingIcon: Logo(type: sample.icon),
onPressed: () => GoRouter.of(context).replaceQueryParam('sample', sample.id),
onPressed: () =>
GoRouter.of(context).replaceQueryParam('sample', sample.id),
child: Padding(
padding: const EdgeInsets.only(right: 32),
child: Text(sample.name),
Expand Down Expand Up @@ -1078,7 +1093,10 @@ class OverflowMenu extends StatelessWidget {
label: 'Install SDK',
uri: 'https://flutter.dev/get-started',
),
(label: 'Sharing guide', uri: 'https://github.com/dart-lang/dart-pad/wiki/Sharing-Guide'),
(
label: 'Sharing guide',
uri: 'https://github.com/dart-lang/dart-pad/wiki/Sharing-Guide'
),
];

@override
Expand Down Expand Up @@ -1190,7 +1208,8 @@ class KeyBindingsTable extends StatelessWidget {
);
}
first = false;
children.add((shortcut as SingleActivator).renderToWidget(context));
children.add(
(shortcut as SingleActivator).renderToWidget(context));
}
return Row(children: children);
},
Expand Down

0 comments on commit 1405a82

Please sign in to comment.