Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello poeple #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added StupidButton/are-you-stupid-desktop-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added StupidButton/assets/fonts/IRAN.ttf
Binary file not shown.
Binary file added StupidButton/assets/fonts/Shabnam.woff
Binary file not shown.
8 changes: 8 additions & 0 deletions StupidButton/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"modules": [],
"module_directory_name": "module",
"experimental_mode": false,
"learning_mode": false,
"unfreezed": true,
"use_cubit": false
}
5 changes: 5 additions & 0 deletions StupidButton/lib/core.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
We believe, the class name must be unique.
If there is a conflicting class name in this file,
it means you have to rename it to something more unique.
*/
165 changes: 165 additions & 0 deletions StupidButton/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import 'package:stupid_button/core.dart';
navigatorKey: Get.navigatorKey,
// sahandmohammadrezaii

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';

void main() {
runApp(const MyApp());

// Add this code below

doWhenWindowReady(() {
const initialSize = Size(400, 250);
appWindow.minSize = initialSize;
appWindow.size = initialSize;
appWindow.alignment = Alignment.center;
appWindow.title = "desgined by sahandmohammadrezaii";
appWindow.show();
});
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: HomePage(),
);
}
}

class HomePage extends StatefulWidget {
const HomePage({super.key});

@override
State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
bool isYesClicked = false;
var noButtonRight = 100;
var noButtonBottom = 30;
int maxRight = 150;
int minRight = 10;
int maxBotton = 30;
int minBotton = 5;
final borderColor = const Color(0xFF805306);

@override
Widget build(BuildContext context) {
return Scaffold(
body: WindowBorder(
color: borderColor,
width: 1,
child: Column(
children: [
WindowTitleBarBox(
child: Row(
children: [
Expanded(
child: MoveWindow(),
),
const WindowButtons(),
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 50.0),
isYesClicked
? const Text(
'مرسی که صادق بودی :)))))',
textDirection: TextDirection.rtl,
style: TextStyle(
fontFamily: 'shabnam',
fontWeight: FontWeight.bold,
fontSize: 25.0,
),
)
: const Text(
'صادقانه پاسخ بده. آیا تو یک احمقی؟؟',
textDirection: TextDirection.rtl,
style: TextStyle(
fontFamily: 'shabnam',
fontWeight: FontWeight.bold,
fontSize: 25.0,
),
),
],
),
const SizedBox(height: 50.0),
SizedBox(
height: 50,
child: Stack(
// sahandmohammadrezaii
children: [
Positioned(
left: 100,
child: GestureDetector(
onTap: () {
setState(() {
isYesClicked = true;
});
},
child: const Text(
'بله، من احمقم',
textDirection: TextDirection.rtl,
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'shabnam',
),
),
),
),
Positioned(
right: noButtonRight.toDouble(),
bottom: noButtonBottom.toDouble(),
child: MouseRegion(
onHover: (event) {
setState(() {
noButtonRight = minRight + Random().nextInt((maxRight + 1) - minRight);
// noButtonBottom = minBotton + Random().nextInt((maxBotton + 1) - minBotton);
});
},
child: const Text(
'نخیر',
textDirection: TextDirection.rtl,
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'shabnam',
),
),
),
),
],
),
)
],
),
),
);
}
}

class WindowButtons extends StatelessWidget {
const WindowButtons({super.key});

@override
Widget build(BuildContext context) {
return Row(
children: [
MinimizeWindowButton(),
MaximizeWindowButton(),
CloseWindowButton(),
],
);
}
}
85 changes: 85 additions & 0 deletions StupidButton/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: stupid_button
description: Desktop App - Code by sahandmohammadrezaii
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
sdk: '>=2.19.2 <3.0.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter


# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
bitsdojo_window: ^0.1.5

dev_dependencies:
flutter_test:
sdk: flutter

# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: shabnam
fonts:
- asset: assets/fonts/Shabnam.woff
# - asset: https://sahand.storage.iran.liara.space/font/Shabnam.woff
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
46 changes: 46 additions & 0 deletions StupidButton/windows/runner/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>

#include "flutter_window.h"
#include "utils.h"
// HERE
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
CreateAndAttachConsole();
}

// Initialize COM, so that it is available for use in the library and/or
// plugins.
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);

flutter::DartProject project(L"data");

std::vector<std::string> command_line_arguments =
GetCommandLineArguments();

project.set_dart_entrypoint_arguments(std::move(command_line_arguments));

FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.Create(L"stupid_buton", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);

::MSG msg;
while (::GetMessage(&msg, nullptr, 0, 0)) {
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}

::CoUninitialize();
return EXIT_SUCCESS;
}