Skip to content

Commit 0d008a8

Browse files
authored
fix: changes the implementation of the display selection screen (#23)
* Fixes Select Screen * deleted displays.json file * Removed display model File and updated pubspec.yaml file * Resolved review comment * Minor issues fixed * Renamed file Changes
1 parent 49d0fed commit 0d008a8

19 files changed

+156
-543
lines changed

assets/displays.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

lib/constants.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import 'package:flutter/material.dart';
22

3-
//Colors used in the app
4-
// Primary Colors
5-
const Color colorPrimary = Color(0xFFD32F2F); // You can adjust this color value
3+
/// Primary Colors
4+
const Color colorPrimary = Color(0xFFD32F2F);
65
const Color colorPrimaryDark = Color(0xFFC72C2C);
76
const Color colorAccent = Color(0xFFD32F2F);
87

9-
// Knob Colors
8+
/// Knob Colors
109
const Color backCircleColor = Color(0xFFEDEDED);
1110
const Color indicatorColor = Color(0xFFD32F2F);
1211
const Color progressSecondaryColor = Color(0xFFEEEEEE);
1312

14-
// Additional Colors
13+
/// Additional Colors
1514
const Color mdGrey400 = Color(0xFFBDBDBD);
1615
const Color dividerColor = Color(0xFFE0E0E0);
1716
const Color drawerHeaderTitle = Color(0xFFFFFFFF);

lib/main.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import 'package:flutter/material.dart';
22
import 'package:magic_epaper_app/provider/image_loader.dart';
3-
import 'package:magic_epaper_app/provider/display_provider.dart';
43
import 'package:provider/provider.dart';
5-
64
import 'package:magic_epaper_app/view/display_selection_screen.dart';
75

86
void main() {
97
runApp(MultiProvider(providers: [
108
ChangeNotifierProvider(create: (context) => ImageLoader()),
11-
ChangeNotifierProvider(create: (context) => DisplayProvider()),
129
], child: const MyApp()));
1310
}
1411

lib/model/display_model.dart

Lines changed: 0 additions & 65 deletions
This file was deleted.

lib/provider/display_provider.dart

Lines changed: 0 additions & 145 deletions
This file was deleted.

lib/util/epd/driver/driver.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
abstract class Driver {
2+
String get driverName;
23
List<int> get transmissionLines;
34
int get refresh;
45
}

lib/util/epd/driver/uc8252.dart renamed to lib/util/epd/driver/uc8253.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import 'driver.dart';
22

33
// UC8253 commands/registers,
44
// define in the epaper display controller (UC8253) reference manual
5-
class Uc8252 extends Driver {
5+
class Uc8253 extends Driver {
66
@override
77
int get refresh => 0x12;
8-
8+
@override
9+
get driverName => 'UC8253';
910
@override
1011
List<int> get transmissionLines => [0x10, 0x13];
1112
}

lib/util/epd/edp.dart renamed to lib/util/epd/epd.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ abstract class Epd {
88
int get width;
99
int get height;
1010
final processingMethods = <img.Image Function(img.Image)>[];
11-
String get description;
11+
String get name;
12+
String get modelId;
13+
String get imgPath;
1214
List<Color> get colors;
1315
Driver get controller;
16+
String get driverName => controller.driverName;
1417

1518
Uint8List _extractEpaperColorFrame(Color color, img.Image orgImage) {
1619
final image = ImageProcessing.extract(color, orgImage);

lib/util/epd/gdey037z03.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
import 'package:flutter/material.dart';
2-
import 'package:magic_epaper_app/util/epd/driver/uc8252.dart';
2+
import 'package:magic_epaper_app/util/epd/driver/uc8253.dart';
33
import 'package:magic_epaper_app/util/image_processing/image_processing.dart';
44
import 'driver/driver.dart';
5-
import 'edp.dart';
5+
import 'epd.dart';
66

77
class Gdey037z03 extends Epd {
8-
@override
9-
String get description => '240x416 BWR (UC8252)';
10-
118
@override
129
get width => 240; // pixels
1310

1411
@override
1512
get height => 416; // pixels
1613

14+
@override
15+
String get name => 'E-Paper 3.7"';
16+
@override
17+
String get modelId => 'GDEY037Z03';
18+
@override
19+
String get imgPath => "assets/images/displays/epaper_3.7_bwr.png";
20+
1721
@override
1822
get colors => [Colors.black, Colors.white, Colors.red];
1923

2024
@override
21-
get controller => Uc8252() as Driver;
25+
get controller => Uc8253() as Driver;
2226

2327
Gdey037z03() {
2428
processingMethods.add(ImageProcessing.rwbTriColorDither);

lib/util/epd/gdey037z03bw.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
import 'package:flutter/material.dart';
2-
import 'package:magic_epaper_app/util/epd/driver/uc8252.dart';
2+
import 'package:magic_epaper_app/util/epd/driver/uc8253.dart';
33
import 'package:magic_epaper_app/util/image_processing/image_processing.dart';
44
import 'driver/driver.dart';
5-
import 'edp.dart';
5+
import 'epd.dart';
66

77
class Gdey037z03BW extends Epd {
8-
@override
9-
String get description => '240x416 BW (UC8252)';
10-
118
@override
129
get width => 240; // pixels
1310

1411
@override
1512
get height => 416; // pixels
1613

14+
@override
15+
String get name => 'E-Paper 3.7"';
16+
@override
17+
String get modelId => 'GDEY037T03';
18+
@override
19+
String get imgPath => "assets/images/displays/epaper_3.7_bw.PNG";
20+
1721
@override
1822
get colors => [Colors.black, Colors.white];
1923

2024
@override
21-
get controller => Uc8252() as Driver;
25+
get controller => Uc8253() as Driver;
2226

2327
Gdey037z03BW() {
2428
processingMethods.add(ImageProcessing.binaryDither);

0 commit comments

Comments
 (0)