Skip to content

Commit

Permalink
remove images from app assets, use cached network images
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhav-Chopra-GT committed Feb 3, 2022
1 parent f8ac044 commit a6f88e5
Show file tree
Hide file tree
Showing 37 changed files with 141 additions and 119 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.history
.svn/
/site/
.venv/

# IntelliJ related
*.iml
Expand Down
Binary file removed assets/simulations/BubbleSortDark.png
Binary file not shown.
Binary file removed assets/simulations/BubbleSortLight.png
Binary file not shown.
Binary file removed assets/simulations/Epicycloid.png
Binary file not shown.
Binary file removed assets/simulations/Epicycloid1Dark.png
Binary file not shown.
Binary file removed assets/simulations/Epicycloid1Light.png
Binary file not shown.
Binary file removed assets/simulations/EpicycloidDark.png
Binary file not shown.
Binary file removed assets/simulations/FourierSeriesDark.png
Binary file not shown.
Binary file removed assets/simulations/FourierSeriesLight.png
Binary file not shown.
Binary file removed assets/simulations/InsertionSortDark.png
Binary file not shown.
Binary file removed assets/simulations/InsertionSortLight.png
Binary file not shown.
Binary file removed assets/simulations/LissajousCurveDark.png
Binary file not shown.
Binary file removed assets/simulations/LissajousCurveLight.png
Binary file not shown.
Binary file removed assets/simulations/MaurerRoseDark.png
Binary file not shown.
Binary file removed assets/simulations/MaurerRoseLight.png
Binary file not shown.
Binary file removed assets/simulations/RosePatternDark.png
Binary file not shown.
Binary file removed assets/simulations/RosePatternLight.png
Binary file not shown.
Binary file removed assets/simulations/ToothpickPatternDark.png
Binary file not shown.
Binary file removed assets/simulations/ToothpickPatternLight.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ git checkout -b [BRANCH NAME]

1. Install mkdocs and its requirements
```bash
python3 -m pip install mkdocs pymdown-extensions mkdocs-material mkdocs-git-revision-date-localized-plugin
python3 -m pip install -r requirements-docs.txt
```
2. Check the installations by:
```bash
Expand Down
1 change: 0 additions & 1 deletion docs/doc/index.md

This file was deleted.

3 changes: 2 additions & 1 deletion lib/src/custom_items/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class HomePage extends StatelessWidget {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(512.0, 850.0),
allowFontScaling: false,
minTextAdapt: false,
);
return Container(
child: ListView(
Expand Down
9 changes: 6 additions & 3 deletions lib/src/custom_items/simulation_card.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
Expand Down Expand Up @@ -59,9 +60,11 @@ class _SimulationCardState extends State<SimulationCard> {
flex: 10,
child: Container(
padding: EdgeInsets.fromLTRB(5, 10, 5, 0),
child: Image.asset(
widget.image,
fit: BoxFit.fill,
child:CachedNetworkImage(
imageUrl: widget.image,
progressIndicatorBuilder: (context, url, downloadProgress) =>
CircularProgressIndicator(value: downloadProgress.progress),
errorWidget: (context, url, error) => Icon(Icons.error),
),
),
),
Expand Down
41 changes: 21 additions & 20 deletions lib/src/data/simulations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:simulate/src/simulations/lissajous_curve.dart';
import 'package:simulate/src/simulations/epicycloid_curve.dart';
import 'package:simulate/src/simulations/maurer_rose.dart';
import 'package:cached_network_image/cached_network_image.dart';

class Simulations with ChangeNotifier {
static var _favorites = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
Expand Down Expand Up @@ -57,8 +58,8 @@ class Simulations with ChangeNotifier {
id: 0,
simulationName: 'Toothpick Pattern',
image: theme.darkTheme
? 'assets/simulations/ToothpickPatternDark.png'
: 'assets/simulations/ToothpickPatternLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/ToothpickPatternDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/ToothpickPatternLight.png',
direct: ToothpickPattern(),
infoLink: 'https://en.wikipedia.org/wiki/Toothpick_sequence',
fav: _favorites[0],
Expand All @@ -67,8 +68,8 @@ class Simulations with ChangeNotifier {
id: 1,
simulationName: 'Bubble Sort (Bars)',
image: theme.darkTheme
? 'assets/simulations/BubbleSortDark.png'
: 'assets/simulations/BubbleSortLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/BubbleSortDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/BubbleSortLight.png',
direct: BubbleSortBars(),
infoLink: 'https://en.wikipedia.org/wiki/Bubble_sort',
fav: _favorites[1],
Expand All @@ -77,8 +78,8 @@ class Simulations with ChangeNotifier {
id: 2,
simulationName: 'Insertion Sort',
image: theme.darkTheme
? 'assets/simulations/InsertionSortDark.png'
: 'assets/simulations/InsertionSortLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/InsertionSortDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/InsertionSortLight.png',
direct: InsertionHome(),
infoLink: 'https://en.wikipedia.org/wiki/Insertion_sort',
fav: _favorites[2],
Expand All @@ -87,8 +88,8 @@ class Simulations with ChangeNotifier {
id: 3,
simulationName: 'Rose Pattern',
image: theme.darkTheme
? 'assets/simulations/RosePatternDark.png'
: 'assets/simulations/RosePatternLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/RosePatternDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/RosePatternLight.png',
direct: RosePattern(),
infoLink: 'https://en.wikipedia.org/wiki/Rose_(mathematics)',
fav: _favorites[3],
Expand All @@ -97,8 +98,8 @@ class Simulations with ChangeNotifier {
id: 4,
simulationName: 'Fourier Series',
image: theme.darkTheme
? 'assets/simulations/FourierSeriesDark.png'
: 'assets/simulations/FourierSeriesLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/FourierSeriesDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/FourierSeriesLight.png',
direct: FourierSeries(),
infoLink: 'https://en.wikipedia.org/wiki/Fourier_series',
fav: _favorites[4],
Expand All @@ -107,8 +108,8 @@ class Simulations with ChangeNotifier {
id: 5,
simulationName: 'Lissajous Pattern',
image: theme.darkTheme
? 'assets/simulations/LissajousCurveDark.png'
: 'assets/simulations/LissajousCurveLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/LissajousCurveDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/LissajousCurveLight.png',
direct: LissajousCurve(),
infoLink: 'https://en.wikipedia.org/wiki/Lissajous_curve',
fav: _favorites[5],
Expand All @@ -117,8 +118,8 @@ class Simulations with ChangeNotifier {
id: 6,
simulationName: 'Epicycloid Pattern (Pencil of Lines)',
image: theme.darkTheme
? 'assets/simulations/Epicycloid1Dark.png'
: 'assets/simulations/Epicycloid1Light.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/Epicycloid1Dark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/Epicycloid1Light.png',
direct: EpicycloidCurve(),
infoLink: 'https://en.wikipedia.org/wiki/Epicycloid',
fav: _favorites[6],
Expand All @@ -127,8 +128,8 @@ class Simulations with ChangeNotifier {
id: 7,
simulationName: 'Epicycloid Curve',
image: theme.darkTheme
? 'assets/simulations/EpicycloidDark.png'
: 'assets/simulations/Epicycloid.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/EpicycloidDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/Epicycloid.png',
direct: NormalEpicycloidCurve(),
infoLink: 'https://en.wikipedia.org/wiki/Epicycloid',
fav: _favorites[7],
Expand All @@ -137,8 +138,8 @@ class Simulations with ChangeNotifier {
id: 8,
simulationName: 'Maurer Rose Pattern',
image: theme.darkTheme
? 'assets/simulations/MaurerRoseDark.png'
: 'assets/simulations/MaurerRoseLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/MaurerRoseDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/MaurerRoseLight.png',
direct: MaurerRoseCurve(),
infoLink: 'https://en.wikipedia.org/wiki/Maurer_rose',
fav: _favorites[8],
Expand All @@ -147,8 +148,8 @@ class Simulations with ChangeNotifier {
id: 9,
simulationName: 'Selection Sort',
image: theme.darkTheme
? 'assets/simulations/InsertionSortDark.png'
: 'assets/simulations/InsertionSortLight.png',
? 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/InsertionSortDark.png'
: 'https://raw.githubusercontent.com/builtree/assets/simulate/web-assets/InsertionSortLight.png',
direct: SelectionSortBars(),
infoLink: 'https://en.wikipedia.org/wiki/Selection_sort',
fav: _favorites[9],
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/bubble_sort.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ class _BubbleSortBarsState extends State<BubbleSortBars> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(512.0, 1024.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/epicycloid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class _NormalEpicycloidCurveState extends State<NormalEpicycloidCurve> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(720.0, 1600.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/epicycloid_curve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ class _EpicycloidCurveState extends State<EpicycloidCurve> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(434.0, 924.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
12 changes: 8 additions & 4 deletions lib/src/simulations/fourier_series.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ class _FourierSeriesState extends State<FourierSeries> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(1024.0, 512.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down Expand Up @@ -122,7 +123,8 @@ class _FourierSeriesState extends State<FourierSeries> {
Slider(
min: 1,
max: 100,
activeColor: Theme.of(context).colorScheme.secondary,
activeColor:
Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -140,7 +142,8 @@ class _FourierSeriesState extends State<FourierSeries> {
Slider(
min: 10,
max: 200,
activeColor: Theme.of(context).colorScheme.secondary,
activeColor:
Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand All @@ -158,7 +161,8 @@ class _FourierSeriesState extends State<FourierSeries> {
Slider(
min: 0,
max: 0.3,
activeColor: Theme.of(context).colorScheme.secondary,
activeColor:
Theme.of(context).colorScheme.secondary,
inactiveColor: Colors.grey,
onChanged: (value) {
setState(() {
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/insertion_sort.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ class _InsertionHomeState extends State<InsertionHome> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(512.0, 1024.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/lissajous_curve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class _LissajousCurveState extends State<LissajousCurve> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(512.0, 1024.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/maurer_rose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class MaurerRoseCurveState extends State<MaurerRoseCurve> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(512.0, 1024.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/rose_pattern.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class _RosePatternState extends State<RosePattern> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(512.0, 1024.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
3 changes: 2 additions & 1 deletion lib/src/simulations/toothpick.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ class _ToothpickPatternState extends State<ToothpickPattern> {
if (constraints.maxWidth != 0) {
ScreenUtil.init(
constraints,
context: context,
designSize: Size(512.0, 1024.0),
allowFontScaling: true,
minTextAdapt: true,
);
return Scaffold(
appBar: AppBar(
Expand Down
Loading

0 comments on commit a6f88e5

Please sign in to comment.