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
Future<void> downloadFile() async { | |
downloading = true; | |
Dio dio = Dio(); | |
try { | |
var dir = await getApplicationDocumentsDirectory(); | |
await dio.download( | |
"https://piccity/223433.png", | |
"${dir.path}/downloaded.png", |
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
import 'package:flutter/material.dart'; | |
class DismissKeyboard extends StatelessWidget { | |
final Widget? child; | |
DismissKeyboard({this.child}); | |
@override | |
Widget build(BuildContext context) { | |
return GestureDetector( | |
onTap: () { |
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
import 'package:flutter/material.dart'; | |
Color mainColor = Color(0xff662D6C); // main app primary color or brand color | |
Color errorTextColor = Colors.red; // color for error text | |
Color grey = Colors.grey; | |
Color whiteBG = Colors.white; | |
Color textFieldBorderColor = Color(0xffb0018a); // color for textfield borders | |
// 102, 45, 108 is the RGB variant of #662D6C | |
Map<int, Color> cColor = { |
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
fonts: | |
- family: JakartaExtraBold | |
fonts: | |
- asset: assets/fonts/jakara/PlusJakartaSans-ExtraBold.ttf | |
- family: JakartaMedium | |
fonts: | |
- asset: assets/fonts/jakara/PlusJakartaSans-Medium.ttf | |
- family: JakartaBold | |
fonts: | |
- asset: assets/fonts/jakara/PlusJakartaSans-Bold.ttf |
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
// themeData for IOS | |
final ThemeData kIOSTheme = new ThemeData( | |
primarySwatch: materialMainColor, | |
primaryColor: mainColor, | |
primaryIconTheme: IconThemeData(color: Colors.white), | |
primaryColorBrightness: Brightness.light, | |
visualDensity: VisualDensity.adaptivePlatformDensity, | |
fontFamily: 'JakartaRegular' | |
); |
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
exports.searchCreators = (req, res) => { | |
var result = {}; | |
var query = req.body.query; | |
User.find({$text: {$search: query}}) | |
.select("-password") | |
.populate('supporters') | |
.sort('-createdAt') | |
.then(users => { | |
result.status = "success"; |
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
// your codes enters here |
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
def connected(self): | |
print(self.address, 'connected') | |
p = threading.Thread(target=p_action, args=(self, 'motion detected')) | |
p.start() | |
self.send_message('HU'+str(humidity)) | |
self.send_message('TE'+str(temperature)) |
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
def handle(self): | |
# echo message back to client | |
global ARMED | |
sensordata = str(self.data) | |
print(sensordata) | |
print(self.address) | |
if (sensordata == 'frontlite1'): | |
print(1) | |
flite.value = 1 | |
self.send_message('front lite ON') |
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
def p_action(client, message): | |
while True: | |
i1 = GPIO.input(pin_pir1) | |
i2 = GPIO.input(pin_pir2) | |
if i1: | |
if ARMED: | |
alarm.value = 1 | |
client.send_message('front: ' + message) | |
if i2: |