Skip to content

Commit

Permalink
Upgrade to latest Flutter version and rewrite entire codebase from sc…
Browse files Browse the repository at this point in the history
…ratch

- Change version to v1.3.0+4.
- Close #27.
  • Loading branch information
masteradit committed Apr 17, 2024
1 parent 5bfb3b6 commit d090551
Show file tree
Hide file tree
Showing 22 changed files with 12,337 additions and 535 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/linter.yml

This file was deleted.

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
Expand All @@ -26,14 +27,10 @@
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

Expand Down
24 changes: 22 additions & 2 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@
# This file should be version controlled and should not be manually edited.

version:
revision: f4abaa0735eba4dfd8f33f73363911d63931fe03
channel: stable
revision: "ba393198430278b6595976de84fe170f553cc728"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ba393198430278b6595976de84fe170f553cc728
base_revision: ba393198430278b6595976de84fe170f553cc728
- platform: web
create_revision: ba393198430278b6595976de84fe170f553cc728
base_revision: ba393198430278b6595976de84fe170f553cc728

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
132 changes: 98 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,83 @@
# AllSQL - An open-source compact browser based SQL Compiler

![style: lint](https://img.shields.io/badge/style-lint-4BC0F5.svg)
![repo size](https://img.shields.io/github/repo-size/masteradit/AllSQL)
![issues open](https://img.shields.io/github/issues/masteradit/AllSQL)
![pull requests open](https://img.shields.io/github/issues-pr/masteradit/AllSQL)
![license: MIT](https://img.shields.io/github/license/masteradit/AllSQL)
![latest version](https://img.shields.io/github/v/release/masteradit/AllSQL)
[![Netlify Status](https://api.netlify.com/api/v1/badges/31d231ee-72ca-4f9a-84d1-7e73ef4851c1/deploy-status)](https://sql.allmityapp.com)
![contributors](https://img.shields.io/github/contributors/masteradit/AllSQL)
![watchers](https://badgen.net/github/watchers/masteradit/AllSQL)
![stars](https://badgen.net/github/stars/masteradit/AllSQL)
![forks](https://badgen.net/github/forks/masteradit/AllSQL)
<!-- ![languages](https://img.shields.io/github/languages/count/masteradit/AllSQL) -->
<!-- ![top language percentage](https://img.shields.io/github/languages/top/masteradit/AllSQL) -->
<!-- ![code size](https://img.shields.io/github/languages/code-size/masteradit/AllSQL) -->
<!-- ![issues closed](https://img.shields.io/github/issues-closed/masteradit/AllSQL) -->
<!-- ![pull requests closed](https://img.shields.io/github/issues-pr-closed/masteradit/AllSQL) -->
<!-- ![commit activity](https://img.shields.io/github/commit-activity/m/masteradit/AllSQL) -->
<!-- ![last commit](https://img.shields.io/github/last-commit/masteradit/AllSQL) -->

AllSQL is an open-source compact browser based SQL Compiler, built using Flutter. Please create an issue on GitHub if you find a bug or have a feature request. Feel free to create pull requests if you are interested in contributing to this project.
<p align="center">
<!-- <a href="https://github.com/calcom/cal.com">
<img src="https://github.com/masteradit/AllSQL/raw/master/images/GitHub-readme-banner.png" alt="Logo">
<img src="./images/GitHub-readme-banner.png" alt="Logo">
</a> -->

<h1 align="center">AllSQL</h1>

<p align="center">
An open-source compact browser-based SQL Compiler, built using Flutter.
<br />
<a href="https://sql.allmityapp.com">Website</a>
·
<a href="https://github.com/masteradit/AllSQL/issues">Issues</a>
·
<a href="https://github.com/masteradit/AllSQL/pulls">Pull Requests</a>
·
<a href="https://github.com/masteradit/AllSQL/discussions">Discussions</a>
</p>
</p>

<p align="center">
<!-- GitHub Stars -->
<a href="https://github.com/masteradit/AllSQL/stargazers"><img src="https://badgen.net/github/stars/masteradit/AllSQL" alt="GitHub Stars"></a>
<!-- License -->
<a href="https://github.com/masteradit/AllSQL/blob/main/LICENSE"><img src="https://img.shields.io/github/license/masteradit/AllSQL" alt="License"></a>
<!-- Style -->
<a href="https://github.com/masteradit/AllSQL"><img src="https://img.shields.io/badge/style-lint-4BC0F5.svg" alt="Style"></a>
<!-- Repo size -->
<a href="https://github.com/masteradit/AllSQL"><img src="https://img.shields.io/github/repo-size/masteradit/AllSQL" alt="Repo Size"></a>
<!-- GitHub Issues -->
<a href="https://github.com/masteradit/AllSQL/issues"><img src="https://img.shields.io/github/issues/masteradit/AllSQL" alt="GitHub Issues"></a>
<!-- GitHub Pull Requests -->
<a href="https://github.com/masteradit/AllSQL/pulls"><img src="https://img.shields.io/github/issues-pr/masteradit/AllSQL" alt="GitHub Pull Requests"></a>
<!-- Commits Per Year -->
<a href="https://github.com/masteradit/AllSQL/pulse"><img src="https://img.shields.io/github/commit-activity/t/masteradit/AllSQL" alt="Commits Per Year"></a>
<!-- Last Commit -->
<a href="https://github.com/masteradit/AllSQL"><img src="https://img.shields.io/github/last-commit/masteradit/AllSQL" alt="Last Commit"></a>
<!-- Pricing -->
<a href="https://github.com/masteradit/AllSQL"><img src="https://img.shields.io/badge/pricing-free-brightgreen" alt="Pricing"></a>
<!-- GitHub Release -->
<a href="https://github.com/masteradit/AllSQL/releases"><img src="https://img.shields.io/github/v/release/masteradit/AllSQL" alt="GitHub Release"></a>
<!-- GitHub Contributors -->
<a href="https://github.com/masteradit/AllSQL/graphs/contributors"><img src="https://img.shields.io/github/contributors/masteradit/AllSQL" alt="GitHub Contributors"></a>
<!-- GitHub Watchers -->
<a href="https://github.com/masteradit/AllSQL/watchers"><img src="https://badgen.net/github/watchers/masteradit/AllSQL" alt="GitHub Watchers"></a>
<!-- Netlify Deploys -->
<a href="https://sql.allmityapp.com"><img src="https://api.netlify.com/api/v1/badges/31d231ee-72ca-4f9a-84d1-7e73ef4851c1/deploy-status" alt="Netlify Deploys"></a>
<!-- TODO: Product Hunt -->
<!-- TODO: Uptime -->
<!-- TODO: Hacker News -->
<!-- TODO: Add more - https://shields.io/ -->
</p>

<p align="center">
<!-- Follow -->
<a class="github-button" href="https://github.com/masteradit" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" data-show-count="true" aria-label="Follow @masteradit on GitHub">Follow @masteradit</a>
<!-- TODO: Sponsor -->
<!-- <a class="github-button" href="https://github.com/sponsors/masteradit" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @masteradit on GitHub">Sponsor</a> -->
<!-- Watch -->
<!-- Place this tag where you want the button to render. -->
<a class="github-button" href="https://github.com/masteradit/AllSQL/subscription" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-eye" data-size="large" data-show-count="true" aria-label="Watch masteradit/AllSQL on GitHub">Watch</a>
<!-- Star -->
<a class="github-button" href="https://github.com/masteradit/AllSQL" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star masteradit/AllSQL on GitHub">Star</a>
<!-- Fork -->
<a class="github-button" href="https://github.com/masteradit/AllSQL/fork" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-repo-forked" data-size="large" data-show-count="true" aria-label="Fork masteradit/AllSQL on GitHub">Fork</a>
<!-- Issue -->
<a class="github-button" href="https://github.com/masteradit/AllSQL/issues" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-issue-opened" data-size="large" data-show-count="true" aria-label="Issue masteradit/AllSQL on GitHub">Issue</a>
<!-- Discuss -->
<a class="github-button" href="https://github.com/masteradit/AllSQL/discussions" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-comment-discussion" data-size="large" aria-label="Discuss masteradit/AllSQL on GitHub">Discuss</a>
<!-- Download -->
<a class="github-button" href="https://github.com/masteradit/AllSQL/archive/HEAD.zip" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-download" data-size="large" aria-label="Download masteradit/AllSQL on GitHub">Download</a>
<!-- More: https://buttons.github.io/ -->
</p>

## ✨ Demo

Website: https://sql.allmityapp.com

![Demo GIF](https://github.com/masteradit/AllSQL/raw/master/images/recording.gif)

*Please ignore the mouse in the gif above. The screen recording software glitched the mouse position.*
<a href="https://sql.allmityapp.com"><img src="https://github.com/masteradit/AllSQL/raw/master/images/recording.gif" alt="AllSQL Demo GIF"></a>

## ⚡ Features

Expand All @@ -38,33 +88,43 @@ Website: https://sql.allmityapp.com
- ✅ Works on web
- ✅ Can be installed as a Progressive Web App on Android, iOS, Windows, MacOS and Linux
- ✅ Works offline
- ✅ Responsive design (works on all screen sizes)

## 🐛 Known issues/bugs

- ❗ Make AllSQL responsive on smaller screens
- ❗ Show error message when an exception is thrown
- ❗ Automatically execute commands instead of selecting the type of command manually

- ❗ Show multiple tables in output if multiple select queries are entered
- ❗ Add dark theme
- ❗ Add syntax highlighting

## 🤔 Why did I make AllSQL?

I have a Database Systems course in college. Our teacher recommended us to download Oracle Database 19c, which is around 2.7 GB in size. Some of my friends faced issues while installing the software. So, I wanted to make a ligh weight, compact, browser based compiler, where anyone could practice SQL commands, on any device without installing a heavy software.
I created AllSQL when I was in college. I had a Database Systems course in college, where our teacher recommended us to download Oracle Database 19c, which is around 2.7 GB in size. Some of my friends faced issues while installing the software. So, I wanted to make a ligh weight, compact, browser based compiler, where anyone could practice SQL commands, on any device without installing a heavy software, which would also work offline so that we could use it during our lab exams as well. Thus, I sat down one night and challenged myself to build an SQL compiler before the next morning that would match all the constraints.

## 👏 Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

### Initial Setup

1. Clone the repo.
2. Run `flutter pub get`. This will get all the dependencies for this project.
3. Run `dart run sqflite_common_ffi_web:setup`. This will create 2 files `sqlite3.wasm` and `sqflite_sw.js`.
> Note: when sqlite3 and its wasm binary are updated, you may need to run the command again using the force option: `dart run sqflite_common_ffi_web:setup --force`
> However since it depends on sqflite3 version and its associated binary, if it gets updated and the tool still download the old version (sorry it is hardcoded) you might have to manually download a compatible binary from sqlite3.wasm binaries I don't have a better option yet, sorry.
> *Source: https://pub.dev/packages/sqflite_common_ffi_web#setup-binaries*
## 📚 Documentation

- Website: https://docs.sql.allmityapp.com/
Expand All @@ -76,6 +136,7 @@ Please ⭐️ this repository if this project helped you!

<a href="https://www.buymeacoffee.com/aditluhadia" target="blank"><img src="https://github.com/masteradit/AllSQL/raw/master/images/bmc-button.png" alt="Buy me a coffee" height="45" /></a>


## 👥 Contributors

<a href="https://github.com/masteradit/AllSQL/graphs/contributors">
Expand All @@ -88,7 +149,7 @@ Made with [contributors-img](https://contrib.rocks).
![Contributors over time](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=masteradit/AllSQL) -->

## Stargazers over time
## ⭐️ Stargazers over time

[![Stargazers over time](https://starchart.cc/masteradit/AllSQL.svg)](https://starchart.cc/masteradit/AllSQL)

Expand All @@ -97,3 +158,6 @@ Made with [contributors-img](https://contrib.rocks).
Copyright © 2021 [Adit Luhadia](https://github.com/masteradit).

This project is [MIT](https://github.com/masteradit/AllSQL/blob/master/LICENSE) licensed.

<!-- Script for GitHub buttons -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
6 changes: 4 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include: package:lint/analysis_options.yaml
include: package:lint/strict.yaml

linter:
rules:
always_use_package_imports: false
prefer_relative_imports: true
prefer_single_quotes: true
prefer_single_quotes: true
avoid_classes_with_only_static_members: false
Binary file modified images/recording.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions lib/config/constants.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import '../models/command_type.dart';

class Constants {
static const Map<CommandType, String> descriptions = {
CommandType.execute:
'Execute an SQL query with no return value.\n\nFor example:\nCREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, value INTEGER);',
CommandType.insert:
"Execute an SQL INSERT query and show the last inserted row ID\n\nFor example:\nINSERT INTO users(name, value) VALUES('Adit', 1234);",
CommandType.query:
'Execute an SQL SELECT query and show the output.\n\nFor example:\nSELECT * FROM users;',
CommandType.update:
"Execute an SQL UPDATE query and show the number of changes made.\n\nFor example:\nUPDATE users SET name = 'Adit Luhadia', value = 1234 WHERE name = 'Adit';",
CommandType.delete:
"Execute an SQL DELETE query and show the number of changes made.\n\nFor example:\nDELETE FROM users WHERE name = 'Adit';",
};
}
37 changes: 37 additions & 0 deletions lib/config/responsive.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';

class Responsive extends StatelessWidget {
final Widget mobile;
final Widget? tablet;
final Widget desktop;

const Responsive({
super.key,
required this.mobile,
this.tablet,
required this.desktop,
});

static bool isMobile(BuildContext context) =>
MediaQuery.of(context).size.width < 850;

static bool isTablet(BuildContext context) =>
MediaQuery.of(context).size.width < 1100 &&
MediaQuery.of(context).size.width >= 850;

static bool isDesktop(BuildContext context) =>
MediaQuery.of(context).size.width >= 1100;

@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;

if (size.width >= 1100) {
return desktop;
} else if (size.width >= 850 && tablet != null) {
return tablet!;
} else {
return mobile;
}
}
}
9 changes: 5 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';

import 'pages/home_page.dart';

void main() {
setUrlStrategy(PathUrlStrategy());
runApp(AllSqlApp());
runApp(const AllSqlApp());
}

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

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'AllSQL',
theme: ThemeData(
primarySwatch: Colors.teal,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.teal),
useMaterial3: true,
),
home: const HomePage(),
);
Expand Down
7 changes: 7 additions & 0 deletions lib/models/command_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enum CommandType {
execute,
insert,
query,
update,
delete,
}
Loading

0 comments on commit d090551

Please sign in to comment.