-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cba786
commit 83b0abe
Showing
4 changed files
with
165 additions
and
53 deletions.
There are no files selected for viewing
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
packages/devtools_app_shared/example/ui/dialog_example.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,38 @@ | ||
// Copyright 2023 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:devtools_app_shared/ui.dart' as devtools_shared_ui; | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Example of using a [DevToolsDialog] widget from | ||
/// 'package:devtools_app_shared/ui.dart'. | ||
class MyDialog extends StatelessWidget { | ||
const MyDialog({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return devtools_shared_ui.DevToolsDialog( | ||
title: const devtools_shared_ui.DialogTitleText('My Cool Dialog'), | ||
content: const Column( | ||
mainAxisSize: MainAxisSize.min, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text('Here is the body of my dialog.'), | ||
SizedBox(height: devtools_shared_ui.denseSpacing), | ||
Text('It communicates something important'), | ||
], | ||
), | ||
actions: [ | ||
devtools_shared_ui.DialogTextButton( | ||
onPressed: () { | ||
// Do someting and then remove the dialog. | ||
Navigator.of(context).pop(devtools_shared_ui.dialogDefaultContext); | ||
}, | ||
child: const Text('DO SOMETHING'), | ||
), | ||
const devtools_shared_ui.DialogCancelButton(), | ||
], | ||
); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
packages/devtools_app_shared/example/ui/split_example.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,73 @@ | ||
// Copyright 2023 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:devtools_app_shared/ui.dart' as devtools_shared_ui; | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Example of using the [Split] widget from | ||
/// 'package:devtools_app_shared/ui.dart' with two children laid across a | ||
/// horizontal axis. | ||
/// | ||
/// This example does not specify the [Split.splitters] parameter, so a | ||
/// default splitter is used. | ||
class SplitExample extends StatelessWidget { | ||
const SplitExample({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return devtools_shared_ui.Split( | ||
axis: Axis.horizontal, | ||
initialFractions: const [0.3, 0.7], | ||
minSizes: const [50.0, 100.0], | ||
children: const [ | ||
Text('Left side'), | ||
Text('Right side'), | ||
], | ||
); | ||
} | ||
} | ||
|
||
/// Example of using the [Split] widget from | ||
/// 'package:devtools_app_shared/ui.dart' with three children laid across a | ||
/// vertical axis. | ||
/// | ||
/// This example uses custom splitters. | ||
class MultiSplitExample extends StatelessWidget { | ||
const MultiSplitExample({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return devtools_shared_ui.Split( | ||
axis: Axis.vertical, | ||
initialFractions: const [0.3, 0.3, 0.4], | ||
minSizes: const [50.0, 50.0, 100.0], | ||
splitters: const [ | ||
CustomSplitter(), | ||
CustomSplitter(), | ||
], | ||
children: const [ | ||
Text('Top'), | ||
Text('Middle'), | ||
Text('Bottom'), | ||
], | ||
); | ||
} | ||
} | ||
|
||
class CustomSplitter extends StatelessWidget implements PreferredSizeWidget { | ||
const CustomSplitter({super.key}); | ||
|
||
static const _size = 50.0; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const SizedBox( | ||
height: _size, | ||
child: Icon(Icons.front_hand), | ||
); | ||
} | ||
|
||
@override | ||
Size get preferredSize => const Size.fromHeight(_size); | ||
} |
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