-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from fluttercandies/modify-controller-code
Modify controller code - fix draw rect and controller problem. - split controller. - provider controller for page.
- Loading branch information
Showing
8 changed files
with
104 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:flutter/foundation.dart'; | ||
|
||
enum BarcodeScanStatus { | ||
init, | ||
scanning, | ||
stop, | ||
} | ||
|
||
extension BarcodeScanStatusExt on BarcodeScanStatus { | ||
bool get isScaning => this == BarcodeScanStatus.scanning; | ||
} | ||
|
||
class BarcodeController extends ValueNotifier<BarcodeScanStatus> { | ||
BarcodeController({ | ||
bool autoStart = true, | ||
}) : super(autoStart ? BarcodeScanStatus.scanning : BarcodeScanStatus.init); | ||
|
||
bool get isScanning => value == BarcodeScanStatus.scanning; | ||
|
||
void start() { | ||
value = BarcodeScanStatus.scanning; | ||
} | ||
|
||
void stop() { | ||
value = BarcodeScanStatus.stop; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters