This file contains hidden or 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
| import 'package:flutter/foundation.dart'; | |
| import 'package:freezed_annotation/freezed_annotation.dart'; | |
| part 'result.freezed.dart'; | |
| @freezed | |
| abstract class Result<T> with _$Result<T> { | |
| const factory Result.idle() = Idle<T>; | |
| const factory Result.loading() = Loading<T>; |
This file contains hidden or 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
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| body: Stack( | |
| fit: StackFit.expand, | |
| children: <Widget>[ | |
| _camera == null | |
| ? Container( | |
| color: Colors.black, | |
| ) |
This file contains hidden or 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
| // Copyright 2018 The Chromium Authors. All rights reserved. | |
| // Paints rectangles around all the text in the image. | |
| class TextDetectorPainter extends CustomPainter { | |
| TextDetectorPainter(this.absoluteImageSize, this.visionText); | |
| final Size absoluteImageSize; | |
| final VisionText visionText; | |
| @override |
This file contains hidden or 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
| bool _isDetecting = false; | |
| VisionText _textScanResults; | |
| CameraLensDirection _direction = CameraLensDirection.back; | |
| CameraController _camera; | |
| final TextRecognizer _textRecognizer = | |
| FirebaseVision.instance.textRecognizer(); |
This file contains hidden or 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
| // Copyright 2018 The Chromium Authors. All rights reserved. | |
| import 'dart:async'; | |
| import 'dart:typed_data'; | |
| import 'dart:ui'; | |
| import 'package:camera/camera.dart'; | |
| import 'package:firebase_ml_vision/firebase_ml_vision.dart'; | |
| import 'package:flutter/foundation.dart'; | |
| class ScannerUtils { |
This file contains hidden or 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
| getAppBar() { | |
| return AppBar( | |
| title: Text(selectedList.length < 1 | |
| ? "Multi Selection" | |
| : "${selectedList.length} item selected"), | |
| actions: <Widget>[ | |
| selectedList.length < 1 | |
| ? Container() | |
| : InkWell( | |
| onTap: () { |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_multiselection_list/home_page.dart'; | |
| class GridItem extends StatefulWidget { | |
| final Key key; | |
| final Item item; | |
| final ValueChanged<bool> isSelected; | |
| GridItem({this.item, this.isSelected, this.key}); |
This file contains hidden or 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
| class MyApp extends StatefulWidget { | |
| @override | |
| _MyAppState createState() => _MyAppState(); | |
| } | |
| class _MyAppState extends State<MyApp> { | |
| DarkThemeProvider themeChangeProvider = new DarkThemeProvider(); | |
| @override | |
| void initState() { |
This file contains hidden or 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
| import 'dart:ui'; | |
| import 'package:flutter/material.dart'; | |
| class Styles { | |
| static ThemeData themeData(bool isDarkTheme, BuildContext context) { | |
| return ThemeData( | |
| primarySwatch: Colors.red, | |
| primaryColor: isDarkTheme ? Colors.black : Colors.white, |
This file contains hidden or 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
| class DarkThemeProvider with ChangeNotifier { | |
| DarkThemePreference darkThemePreference = DarkThemePreference(); | |
| bool _darkTheme = false; | |
| bool get darkTheme => _darkTheme; | |
| set darkTheme(bool value) { | |
| _darkTheme = value; | |
| darkThemePreference.setDarkTheme(value); | |
| notifyListeners(); |