-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
29 changed files
with
1,616 additions
and
1,032 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,21 @@ | ||
import 'package:example/widgets/my_app.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:stage_craft/stage_craft.dart'; | ||
|
||
class MyAppStageData extends WidgetStageData { | ||
@override | ||
String get name => 'My App'; | ||
|
||
@override | ||
List<FieldConfigurator> get stageConfigurators => []; | ||
|
||
@override | ||
List<FieldConfigurator> get widgetConfigurators => []; | ||
|
||
@override | ||
Widget widgetBuilder(BuildContext context) { | ||
return const MyApp( | ||
maxContentWidth: 1440, | ||
); | ||
} | ||
} |
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,142 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class MyApp extends StatelessWidget { | ||
const MyApp({ | ||
super.key, | ||
required this.maxContentWidth, | ||
}); | ||
|
||
final double maxContentWidth; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const MaterialApp( | ||
home: Page(), | ||
); | ||
} | ||
} | ||
|
||
class Page extends StatefulWidget { | ||
const Page({super.key}); | ||
|
||
@override | ||
State<Page> createState() => _PageState(); | ||
} | ||
|
||
class _PageState extends State<Page> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: Center( | ||
child: ConstrainedBox( | ||
constraints: const BoxConstraints( | ||
maxWidth: 1440, | ||
), | ||
child: Container( | ||
decoration: const BoxDecoration( | ||
color: Colors.grey, | ||
), | ||
child: const PageContent(), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class PageContent extends StatefulWidget { | ||
const PageContent({super.key}); | ||
|
||
@override | ||
State<PageContent> createState() => _PageContentState(); | ||
} | ||
|
||
class _PageContentState extends State<PageContent> { | ||
int _selectedItem = 1; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return LayoutBuilder( | ||
builder: (BuildContext context, BoxConstraints constraints) { | ||
if (constraints.maxWidth > 700) { | ||
return Row( | ||
children: [ | ||
SizedBox( | ||
width: 500, | ||
child: ItemList( | ||
onItemSelected: (int selectedItem) { | ||
setState(() { | ||
_selectedItem = selectedItem; | ||
}); | ||
}, | ||
), | ||
), | ||
DetailView(id: _selectedItem), | ||
], | ||
); | ||
} | ||
return ItemList( | ||
onItemSelected: (int selectedItem) { | ||
Navigator.of(context).push( | ||
MaterialPageRoute( | ||
builder: (context) { | ||
return DetailView(id: selectedItem); | ||
}, | ||
), | ||
); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
} | ||
|
||
class ItemList extends StatelessWidget { | ||
const ItemList({ | ||
super.key, | ||
required this.onItemSelected, | ||
}); | ||
|
||
final void Function(int selectedItem) onItemSelected; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SingleChildScrollView( | ||
child: ListView.builder( | ||
shrinkWrap: true, | ||
itemCount: 30, | ||
itemBuilder: (context, index) { | ||
return MouseRegion( | ||
cursor: SystemMouseCursors.click, | ||
child: GestureDetector( | ||
onTap: () { | ||
onItemSelected(index); | ||
}, | ||
child: Container( | ||
height: 100, | ||
color: Colors.blue, | ||
child: Text('Item $index'), | ||
), | ||
), | ||
); | ||
}, | ||
), | ||
); | ||
} | ||
} | ||
|
||
class DetailView extends StatelessWidget { | ||
const DetailView({ | ||
super.key, | ||
required this.id, | ||
}); | ||
|
||
final int id; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Center( | ||
child: Text('Detail $id'), | ||
); | ||
} | ||
} |
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 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
Oops, something went wrong.