Skip to content

Commit

Permalink
update window ui
Browse files Browse the repository at this point in the history
  • Loading branch information
LiquidatorCoder2 committed Nov 13, 2021
1 parent a3ca981 commit 6a537c2
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 11 deletions.
14 changes: 13 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart';
import 'package:odin/pages/home_page.dart';

void main() {
runApp(const MyApp());
doWhenWindowReady(() {
final win = appWindow;
const initialSize = Size(412, 192);
win.minSize = initialSize;
win.size = initialSize;
win.maxSize = initialSize;
win.alignment = Alignment.center;
win.title = "Odin";
win.show();
});
}

class MyApp extends StatelessWidget {
Expand All @@ -11,7 +22,8 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
title: 'Odin',
theme: ThemeData(
primarySwatch: Colors.blue,
),
Expand Down
28 changes: 18 additions & 10 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import 'package:flutter/material.dart';
import 'package:odin/widgets/window_top_bar.dart';

class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
const backgroundStartColor = Color(0xFF121212);
const backgroundEndColor = Color(0xFF202020);

@override
State<HomePage> createState() => _HomePageState();
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);

class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: Text(
'Welcome to Odin',
return Scaffold(
body: Container(
decoration: const BoxDecoration(
gradient: RadialGradient(
colors: [backgroundStartColor, backgroundEndColor],
radius: 1.5,
stops: [0.0, 1.0],
),
),
child: Column(
children: const [
WindowTopBar(),
],
),
),
);
Expand Down
36 changes: 36 additions & 0 deletions lib/widgets/window_buttons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart';

final buttonColors = WindowButtonColors(
iconNormal: const Color(0xFF383838),
mouseOver: const Color(0xFF282828),
mouseDown: const Color(0xFF383838),
iconMouseOver: const Color(0xFF787878),
iconMouseDown: const Color(0xFFFAFAFA),
);

final closeButtonColors = WindowButtonColors(
mouseOver: const Color(0xFF282828),
mouseDown: const Color(0xFFB71C1C),
iconNormal: const Color(0xFF383838),
iconMouseOver: const Color(0xFFD32F2F));

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

@override
Widget build(BuildContext context) {
return Row(
children: [
MinimizeWindowButton(
colors: buttonColors,
animate: true,
),
CloseWindowButton(
colors: closeButtonColors,
animate: true,
),
],
);
}
}
23 changes: 23 additions & 0 deletions lib/widgets/window_top_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart';
import 'package:odin/widgets/window_buttons.dart';

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

@override
Widget build(BuildContext context) {
return WindowTitleBarBox(
child: Row(
children: [
Expanded(
child: MoveWindow(),
),
const WindowButtons()
],
),
);
}
}

0 comments on commit 6a537c2

Please sign in to comment.