mirror of
https://github.com/ALEZ-DEV/Babylonia-terminal.git
synced 2025-12-16 17:38:51 +00:00
add dragable window
This commit is contained in:
parent
4122d9f84f
commit
434e37e3f2
@ -110,61 +110,74 @@ class _MenuState extends State<Menu> {
|
|||||||
|
|
||||||
return ChangeNotifierProvider(
|
return ChangeNotifierProvider(
|
||||||
create: (context) => Game(),
|
create: (context) => Game(),
|
||||||
child: Scaffold(
|
child: Stack(
|
||||||
drawer: Drawer(
|
children: [
|
||||||
child: ListView(
|
Scaffold(
|
||||||
children: items,
|
drawer: Drawer(
|
||||||
),
|
child: ListView(
|
||||||
),
|
children: items,
|
||||||
appBar: AppBar(
|
|
||||||
title: const Text("Babylonia Terminal"),
|
|
||||||
centerTitle: true,
|
|
||||||
actions: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 14.0),
|
|
||||||
child: YaruWindowControl(
|
|
||||||
type: YaruWindowControlType.minimize,
|
|
||||||
platform: YaruWindowControlPlatform.yaru,
|
|
||||||
onTap: () async {
|
|
||||||
final state = await window.state();
|
|
||||||
if (state.isMinimizable ?? false) window.minimize();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
StreamBuilder<YaruWindowState>(
|
appBar: AppBar(
|
||||||
stream: window.states(),
|
title: const Text("Babylonia Terminal"),
|
||||||
builder: (context, snapshot) {
|
centerTitle: true,
|
||||||
final state = snapshot.data;
|
actions: [
|
||||||
return Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 14.0),
|
padding: const EdgeInsets.only(right: 14.0),
|
||||||
child: YaruWindowControl(
|
child: YaruWindowControl(
|
||||||
type: (state?.isMinimizable ?? false)
|
type: YaruWindowControlType.minimize,
|
||||||
? YaruWindowControlType.maximize
|
|
||||||
: YaruWindowControlType.restore,
|
|
||||||
platform: YaruWindowControlPlatform.yaru,
|
platform: YaruWindowControlPlatform.yaru,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
(state?.isMinimizable ?? false)
|
final state = await window.state();
|
||||||
? window.maximize()
|
if (state.isMinimizable ?? false) window.minimize();
|
||||||
: window.restore();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
StreamBuilder<YaruWindowState>(
|
||||||
|
stream: window.states(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final state = snapshot.data;
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 14.0),
|
||||||
|
child: YaruWindowControl(
|
||||||
|
type: (state?.isMinimizable ?? false)
|
||||||
|
? YaruWindowControlType.maximize
|
||||||
|
: YaruWindowControlType.restore,
|
||||||
|
platform: YaruWindowControlPlatform.yaru,
|
||||||
|
onTap: () async {
|
||||||
|
(state?.isMinimizable ?? false)
|
||||||
|
? window.maximize()
|
||||||
|
: window.restore();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 10.0),
|
||||||
|
child: YaruWindowControl(
|
||||||
|
type: YaruWindowControlType.close,
|
||||||
|
platform: YaruWindowControlPlatform.yaru,
|
||||||
|
onTap: () async {
|
||||||
|
final state = await window.state();
|
||||||
|
if (state.isClosable ?? false) window.close();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
body: Screens.getCurrent(_selectedIndex),
|
||||||
padding: const EdgeInsets.only(right: 10.0),
|
),
|
||||||
child: YaruWindowControl(
|
Padding(
|
||||||
type: YaruWindowControlType.close,
|
padding: const EdgeInsets.only(right: 115.0, left: 60.0),
|
||||||
platform: YaruWindowControlPlatform.yaru,
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onPanStart: (_) => window.drag(),
|
||||||
final state = await window.state();
|
child: const SizedBox(
|
||||||
if (state.isClosable ?? false) window.close();
|
height: 60,
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
body: Screens.getCurrent(_selectedIndex),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user