Skip to content

Commit

Permalink
recoding app version 4: Custom, fix bug rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunhThanhDe committed Sep 22, 2022
1 parent c80fa22 commit b1aa8e4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 1,206 deletions.
130 changes: 6 additions & 124 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'screens/camera_screen.dart';
import 'camera_page.dart';

List<CameraDescription> cameras = [];

Future<void> main() async {
try {
WidgetsFlutterBinding.ensureInitialized();
cameras = await availableCameras();
} on CameraException catch (e) {
print('Error in fetching the cameras: $e');
}
void main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
runApp(const MyApp());
}

Expand All @@ -25,120 +20,7 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
home: CustomCamera(),
home: const CameraPage(),
);
}
}

// class MyHomePage extends StatefulWidget {
// const MyHomePage({Key? key}) : super(key: key);
//
// @override
// State<MyHomePage> createState() => _MyHomePageState();
// }
//
// class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {
// bool ActiveConnection = false;
//
// Future CheckUserConnection() async {
// try {
// final result = await InternetAddress.lookup('google.com');
// if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
// setState(() {
// ActiveConnection = true;
// Fluttertoast.showToast(
// msg: "wifi đã kết nối",
// toastLength: Toast.LENGTH_SHORT,
// gravity: ToastGravity.BOTTOM,
// timeInSecForIosWeb: 2,
// backgroundColor: Colors.white54,
// textColor: Colors.white,
// fontSize: 16.0
// );
// });
// }
// } on SocketException catch (_) {
// setState(() {
// ActiveConnection = false;
// Fluttertoast.showToast(
// msg: "Hãy kết nối wifi để có thể upload lên server",
// toastLength: Toast.LENGTH_SHORT,
// gravity: ToastGravity.BOTTOM,
// timeInSecForIosWeb: 2,
// backgroundColor: Colors.white54,
// textColor: Colors.white,
// fontSize: 16.0
// );
// });
// }
// }
//
//
// @override
// void initState() {
// CheckUserConnection();
// super.initState();
// WidgetsBinding.instance.addObserver(this);
// }
//
// @override
// void dispose() {
// super.dispose();
// WidgetsBinding.instance.removeObserver(this);
// }
//
// @override
// void didChangeAppLifecycleState(AppLifecycleState state) {
// super.didChangeAppLifecycleState(state);
// if (state == AppLifecycleState.inactive ||
// state == AppLifecycleState.detached) return;
// }
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: const Text(
// 'Camera Flutter App',
// style: TextStyle(
// fontSize: 20,
// ),
// ),
// ),
// body: Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: const [
// Text(
// 'Thực hành phát triển ứng dụng record Video từ Camera và Upload video lên Server',
// style: TextStyle(
// color: Colors.blue,
// fontSize: 20,
// fontStyle: FontStyle.italic,
// ),
// textAlign: TextAlign.center,
// ),
// SizedBox(
// height: 300,
// )
// ],
// ),
// ),
// floatingActionButton: FloatingActionButton.extended(
// splashColor: Colors.purple,
// tooltip: 'Camera',
// label: Row(
// children: const [
// Icon(Icons.not_started_outlined),
// Text(' Start'),
// ],
// ),
// onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => CameraPage()));
// },
// ),
// );
// }
// }
Loading

0 comments on commit b1aa8e4

Please sign in to comment.