Flutter

Expand DataTable to fill height in Flutter

限于喜欢 提交于 2021-02-08 07:24:57
问题 I have a problem with flutter. I need to fill a DataTable in the height of screen. I tried to add the dataTable inside a Flex widget, but I don't get changes. When I set the heigh of the Container, that's work let me a white space at the button of the screen Thank you! and i'm sorry for mi poor english This my code: products.addAll(Product.getExampleList()); var table = Container( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child:SizedBox( child: Column( children: <Widget>

Create buttons with negative border radius and align them in Flutter

我的梦境 提交于 2021-02-08 06:55:43
问题 I want to build a layout like this Where the two external elements are buttons, while the inner one is a TextField. How can I create a layout like this in Flutter? My idea was to use absolute positions to align the left side of each element and to use elevation to handle overlapping but I'm not sure it's the best way and I don't know how to create the buttons. 回答1: I would use a CustomPainter class, with which you build the buttons. Then you use the RawMaterialButton and CustomPaint widget to

Calculate logical pixels from millimeters

大兔子大兔子 提交于 2021-02-08 06:26:14
问题 I have a design with widths, heights, paddings... in millimeters. I'm now trying to figure out how to convert those numbers to the logical pixel system Flutter uses. I found the docs for the device pixel ratio but I'm not sure how to interpret that number and I quote: The Flutter framework operates in logical pixels, so it is rarely necessary to directly deal with this property. So I am not sure if this is the way to go. My question comes down to this: Is there an easy way to calculate from

How to draw custom shape in flutter and drag that shape around?

扶醉桌前 提交于 2021-02-08 06:14:28
问题 At the moment I can draw rectangles using CustomPainter. Below the code inside the paint method of my CustomPainter. for (var rectPoints in rectangles) { paint.color = rectPoints.color; paint.strokeWidth = rectPoints.strokeWidth; if (rectPoints.selected != null && rectPoints.selected == true) { paint.color = Colors.black45; } var rect = Rect.fromLTWH( rectPoints.startPoint.dx, rectPoints.startPoint.dy, rectPoints.endPoint.dx - rectPoints.startPoint.dx, rectPoints.endPoint.dy - rectPoints

How to draw custom shape in flutter and drag that shape around?

北城余情 提交于 2021-02-08 06:14:24
问题 At the moment I can draw rectangles using CustomPainter. Below the code inside the paint method of my CustomPainter. for (var rectPoints in rectangles) { paint.color = rectPoints.color; paint.strokeWidth = rectPoints.strokeWidth; if (rectPoints.selected != null && rectPoints.selected == true) { paint.color = Colors.black45; } var rect = Rect.fromLTWH( rectPoints.startPoint.dx, rectPoints.startPoint.dy, rectPoints.endPoint.dx - rectPoints.startPoint.dx, rectPoints.endPoint.dy - rectPoints

Divide screen into 4 different parts evenly

百般思念 提交于 2021-02-08 05:39:34
问题 Help me Guys I am new to the flutter development I am trying to make this type of layout here is the layout I wanted but I am getting this layout Look of the layout is this here is my code friends please help out friends I had started the development of the flutter recently guys I had tried the fitted box and expanded class as well Home.dart class HomeScreen extends StatefulWidget { @override State<StatefulWidget> createState() { HomeScreen_Page homecreatestate() => HomeScreen_Page(); return

How to pass data to previous screen in Flutter using Navigator? (need to handle all cases: swipe to go back, press back, etc)

别说谁变了你拦得住时间么 提交于 2021-02-08 05:17:43
问题 Let's say I'm passing data between screens using default way with Navigator.pop: @override void selectUserAction(BuildContext context) async { final result = await Navigator.of(context).push( MaterialPageRoute(builder: (context) => SelectUserPage())); final User selectedUser = result as UserModel; } Navigator.pop(context, selectedUser); So everything goes well in that case. And I know I can handle back button interaction (onPressed) using AppBar leading property like this: leading: IconButton

Sending Android SMS BroadcastReceiver data to Flutter through EventChannel

让人想犯罪 __ 提交于 2021-02-08 05:16:36
问题 I am trying to listen for any incoming SMS messages on an Android device and then showing a toast in my Flutter app whenever an SMS is received. I am connecting to Flutter through EventChannel and detecting SMS using a BroadcastReceiver. How do I send an events.success(message) whenever my broadcast receiver detects an SMS? I tried adding the BroadcastReceiver directly inside the EventChannel but that did not work. The flutter SMS package also doesn't seem to work. This is what my

Flutter App is Incompatible With Nearly Everything?

人盡茶涼 提交于 2021-02-08 04:38:31
问题 I have built a Flutter app that works perfectly on my phone, but none of the others I have tried it on. Here's the Git repo. My problem is that when I try to install from the APK I build, all the devices I'm trying to install it on say that the app is "incompatible." I have tried the app on the following devices: Samsung Galaxy J3 Huawei P10 Samsung Galaxy Core Prime LG something-or-other It works on my Samsung Galaxy S8, and the Samsung Galaxy S7. Any and all help is greatly appreciated, as

Flutter desktop - send PDF to a printer

*爱你&永不变心* 提交于 2021-02-08 04:23:29
问题 I have a requirement to print PDF on the printer from the Flutter app. Is there a chance to have a possibility to do so right now? I mean that my application is going to fetch the PDF file from the server and then I would like to put it directly to the printer, so it can be printed instantly. The platform that I am targetting is windows. If this is not possible then is there a chance to execute .bat script using flutter? In the case that there would be no such possibility I could make the