Professional Documents
Culture Documents
Baocao Ttnhung
Baocao Ttnhung
ui/style.dart :
import 'package:flutter/material.dart';
class AppStyle {
color: Colors.black,
fontSize: 32.0,
fontWeight: FontWeight.bold,
);
color: Colors.white,
fontSize: 32.0,
fontWeight: FontWeight.bold,
);
color: Colors.black87,
fontSize: 32.0,
fontWeight: FontWeight.w300,
);
color: Colors.white60,
fontSize: 32.0,
fontWeight: FontWeight.w300,
);
}
utils / time_model.dart :
class TimeModel {
int? sec;
int? min;
int? hour;
Widget :
clock_widget.dart :
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_hello/ui/style.dart';
import 'package:flutter_hello/utils/time_model.dart';
// ignore: must_be_immutable
ClockWidget(this.time,{super.key});
TimeModel time;
@override
@override
decoration: BoxDecoration(
shape: BoxShape.circle,
boxShadow: [
),
height: 300.0,
width: 300.0,
child: CustomPaint(
painter: ClockPainter(widget.time),
),
);
TimeModel? time;
ClockPainter(this.time);
@override
..color = AppStyle.primaryColor
..strokeCap = StrokeCap.round;
..color = Colors.red
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 2
..strokeJoin = StrokeJoin.round;
..color = Colors.white
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 3
..strokeJoin = StrokeJoin.round;
..color = Colors.white
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 4
..strokeJoin = StrokeJoin.round;
@override
return true;
}
main.dart :
//import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_hello/ui/style.dart';
import 'package:flutter_hello/utils/time_model.dart';
import 'package:flutter_hello/widgets/clock_widget.dart';
import 'package:timer_builder/timer_builder.dart';
void main() {
runApp(const MyApp());
const MyApp({super.key});
@override
home: HomePage(),
);
const HomePage({super.key});
@override
}
class _HomePageState extends State<HomePage> {
@override
return Scaffold(
body: SafeArea(
child: Padding(
child: Column(
children: [
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"$hours:$minutes:$seconds",
style: AppStyle.mainText,
),
],
),
Center(
);
})
],
),
),
),
);
}
QUAN LI KHO
main.dart :
import 'package:flutter/material.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
class Product {
String barcode;
String name;
double price;
int quantity;
DateTime date;
Product({
required this.barcode,
required this.name,
required this.price,
required this.quantity,
required this.date,
});
const MyApp({super.key});
@override
return MaterialApp(
primarySwatch: Colors.brown,
),
);
const MyHomePage({super.key});
@override
// ignore: library_private_types_in_public_api
try {
'#ff6666',
'Thoát',
true,
ScanMode.QR,
);
if (barcode != '-1') {
name: '',
price: 0.0,
quantity: 0,
date: DateTime.now(),
),
);
_showAddProductDialog(existingProduct);
} catch (e) {
TextEditingController nameController =
TextEditingController(text: existingProduct.name);
TextEditingController priceController =
TextEditingController(text: existingProduct.price.toString());
TextEditingController quantityController =
TextEditingController(text: existingProduct.quantity.toString());
TextEditingController dateController =
TextEditingController(text: existingProduct.quantity.toString());
showDialog(
context: context,
return AlertDialog(
content: Column(
children: <Widget>[
controller: nameController,
),
TextField(
controller: priceController,
keyboardType: TextInputType.number,
),
TextField(
controller: quantityController,
keyboardType: TextInputType.number,
),
],
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
onPressed: () {
if (nameController.text.isNotEmpty &&
priceController.text.isNotEmpty &&
quantityController.text.isNotEmpty) {
if (existingProduct.name.isEmpty) {
// If the product doesn't exist, create a new one with the current date and time
name: nameController.text,
price: double.parse(priceController.text),
quantity: int.parse(quantityController.text),
date: DateTime.now(),
);
setState(() {
inventory.add(newProduct);
});
} else {
int.parse(quantityController.text);
setState(() {
inventory[productIndex].quantity = updatedQuantity;
});
Navigator.of(context).pop();
},
),
],
);
},
);
void _showInventoryDialog() {
showDialog(
context: context,
content: SizedBox(
width: double.maxFinite,
child: ListView.builder(
itemCount: inventory.length,
return ListTile(
subtitle: Text(
),
);
},
),
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
void _sellProduct() async {
try {
'#ff6666',
'Thoát',
true,
ScanMode.QR,
);
if (barcode != '-1') {
barcode: barcode,
price: 0.0,
quantity: 0,
date: DateTime.now(),
),
);
if (productToSell.quantity > 0) {
setState(() {
inventory[productIndex].quantity -= 1;
});
if (productToSell.quantity == -1) {
_showFailDialog();
} else {
_showSuccessDialog(productToSell);
print(
} else {
_showFailDialog();
} catch (e) {
showDialog(
context: context,
return AlertDialog(
content: Text(
actions: [
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
void _showFailDialog() {
showDialog(
context: context,
return AlertDialog(
actions: [
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
@override
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.amber,
),
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ElevatedButton(
onPressed: _scanQRCode,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.amber),
padding: MaterialStateProperty.all<EdgeInsets>(
),
),
'Quét mã QR',
),
),
ElevatedButton(
onPressed: _showInventoryDialog,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.amber),
padding: MaterialStateProperty.all<EdgeInsets>(
),
),
),
),
ElevatedButton(
onPressed: _sellProduct,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.amber),
padding: MaterialStateProperty.all<EdgeInsets>(
),
),
'Xuất kho',
),
),
],
),
),
);
}
GIS-MAP HIGHSCHOOL IN THU DUC, HCM CITY
main.dart :
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
void main() {
runApp(const MyApp());
const MyApp({super.key});
@override
return MaterialApp(
theme: ThemeData(
useMaterial3: true,
),
);
@override
List<bool> flags = [false, false, false, false, false, false, false, false, false, false, false];
@override
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
'TÔ ĐÌNH PHÚC - 20119366 \n Gismap about High School in Thu Duc, HCM city',
),
),
body: content(),
);
Widget content() {
return FlutterMap(
initialZoom: 12,
interactionOptions:
InteractionOptions(flags: ~InteractiveFlag.doubleTapZoom)
),
children: [
openStreetMapTileLayer,
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
//THPT Nguyen Huu Huan
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
flags[0] ? const Text('THPT Nang Khieu, Dai Hoc Quoc Gia TpHCM') : const SizedBox.shrink(),
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
flags[0] ? const Text('THPT Phuong Nam') : const SizedBox.shrink(),
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
GestureDetector(
onTap: () {
setState(() {
flags[0] = !flags[0];
});
},
child: MarkerLayer(markers: [
Marker(
width: 60,
height: 60,
alignment: Alignment.centerLeft,
child: Column(
children: [
const Icon(
Icons.location_pin,
size: 30,
color: Colors.red,
),
],
),
),
],),
),
],);
urlTemplate: 'http://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'dev.fleaflet.flutter_map.example',
);