Flutter

Paytabs payment integration using dart, flutter web and api

主宰稳场 提交于 2021-01-29 09:01:34
问题 I have a flutter web project and I was trying to implement a payment solution. I found out that paytabs is a good choice for my situation. I wanted to add their api but I kept getting the CORS erorr over my flutter website. So I tried their ready payment page but I am also unable to implement since I have no previous knowledge about web development. I only use dart and flutter. But I would like to implement the api since it gives higher control. This is the url used for post requests https:/

DART: Passing function in a function as parameter

此生再无相见时 提交于 2021-01-29 08:57:08
问题 The below snippet of code gives me error in dartpad. But the same code works fine in the course which I am doing online. I am using dart version 2.8.4. void main() { int var = operation(5,5,add); --> Error //print(operation(5,5,add)); } // class calculator { // calculator({this.operand}); // } int add(int n1, int n2) { return n1+n2; } int multiply(int n1, int n2) { return n1*n2; } int operation(int n1, int n2, Function operand){ return operand(n1, n2); } Error: Error compiling to JavaScript:

Is there any memory issues when using timer and nested stream in flutter app

喜你入骨 提交于 2021-01-29 08:49:52
问题 I am using nested stream and a timer method for my app. Which is like a display board changes values (or screen) in every 10 seconds and repeat. I have not any quite idea about the problems in my code (it just seems working well), also thinking to add a clock in my screen, which am not sure how to implement yet (using stream again or with initstate ). Please check my main code and give me some tips to clean up any issues if there. My app is using firebase to get latest data. class OmApp

Changing backgroundcolor depending on variable in flutter

一曲冷凌霜 提交于 2021-01-29 08:47:59
问题 With Flutter i want to change the backgroundcolor of my app whenever the value of "color" variable changes. String color = "white"; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.green, I don't know how to set color to backgroundColor proprety. 回答1: To store your color value, you can use Color type data: Color myColor = Colors.white; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: myColor, After that, you can change the

Redirect to google maps app with directions between source and destination with some stops in flutter

此生再无相见时 提交于 2021-01-29 08:46:11
问题 I want to redirect to google maps app for navigation with some stops between source and destination from my flutter application. url_launcher package redirects to map with source and destination but I want with some stops. Is that possible? 回答1: If you want to navigate with directions you can just create a url with source and destination co-ordinates and other coordinates to add as stops. Steps: 1. Install url_launcher plugin write a code like below. _launchURL(String url) async { if (await

how to display animated images in flutter

可紊 提交于 2021-01-29 08:44:02
问题 In my app i want to represent rolling dice. currently when i roll the dice it move randomly to one of the six images without any animation. all what i want is to display animation scene,it takes 2 second moving between six images as if the dice is rolling. i tried with the setState() but it only work when i click the button is there is a way use setState() in loop and this is my state class class _DicePageState extends State<DicePage> { int leftButtonImage = 2; int rightButtonImage = 3; void

BottomNavigationBar Transparent Background

ぐ巨炮叔叔 提交于 2021-01-29 08:43:41
问题 I'm trying to build a BottomNavigationBar that has no background (transparent), so far this is what I have done, but I still have shadows which should also be removed: return Scaffold( body: body, bottomNavigationBar: Theme( data: Theme.of(context).copyWith( canvasColor: Colors.transparent, primaryColor: Colors.white, textTheme: Theme .of(context) .textTheme .copyWith(caption: TextStyle(color: Colors.deepOrange))), child: BottomNavigationBar( type: BottomNavigationBarType.fixed, currentIndex:

How to make a widget's size same as another widget in Flutter

白昼怎懂夜的黑 提交于 2021-01-29 08:43:35
问题 The length of the texts on right is not fixed. I want to make the height of the line on left same as the texts area height. Is there a way to align a widget to another widget like Android's RelativeLayout or ConstraintLayout in Flutter? my code: Container( padding: EdgeInsets.fromLTRB(100, 0, 100, 0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( color: Color(0xFFEEEEEE), width: 4, height: 80, margin: EdgeInsets.only(right: 10), ), Expanded( child:

Errors in my dart code and other errors with android studio

白昼怎懂夜的黑 提交于 2021-01-29 08:38:40
问题 Note: I am a beginner in flutter and dart so please make the answers understandable When I opened the avd manager and ran the phone, it showed "unable to locate adb" and then opened the phone. (It's takes a long time to load) When I ran the program in android studio, I got these errors: (also got the same errors in flutter console) C:\Flutter SDK\flutter\bin\cache\dart-sdk\bin\dart.exe" --enable-asserts --enable-vm-service:58163 C:\Users\user\my_app\lib\main.dart lib/main.dart: Warning:

Google Map in Flutter App is not showing up

淺唱寂寞╮ 提交于 2021-01-29 08:36:38
问题 I have a problem in intergrating a simple GoogleMap in my Flutter App. I correctly inserted the API Key in my Manifest file and inserted the library in the app. But the emulator is just showing a blank page. I am doing nothing special until now; just trying to create a GoogleMap. This is the Code i am using in the App: return Stack( children: <Widget>[ GoogleMap(initialCameraPosition: CameraPosition(target: LatLng(-33.870840,151.206286), zoom: 12) ) ], ); What the emulator is showing: The