#StackBounty: #flutter #firebase-cloud-messaging Flutter background Firebase communication

Bounty: 100

In my Flutter project, I want to be able to request some data from the smartphone of the user. Now, since I use Firebase, I tried out the firebase_messaging plugin. At this point, it enables me to send a notification message to the device and once I click on it, the callback is triggered that does the required logic and sends the data to firebase.

However, my problem with this approach is that the user really needs to click on the notification in order to trigger the callback. It looks like the firebase_messaging plugin only supports notification-messages and not pure data ones. So I am kind of restricted to only executing my code once a notification is clicked on.

My question is, is there a way to trigger my code in the Flutter app without the notification?

I would love to be able to send some data requests to the device and receive some response back (or at least trigger some code). Maybe there is another plugin or some hacks somebody is aware of?

Thank you in advance.


Get this bounty!!!

#StackBounty: #flutter #dart How to Add Dynamic table to Flutter

Bounty: 50

How to map existing values to a Flutter Dynamic Table?

The following is my existing working code. is using json to print the values. those existing values I would like to print to a table and eventually sort them by columns.
Note: New to Flutter and I appreciate your assistance.

class PhotosList extends StatelessWidget {
  final List<Photo> photos;

  PhotosList({Key key, this.photos}) : super(key: key);



  @override
  Widget build(BuildContext context) {


    return GridView.builder(
      gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
        crossAxisCount: 2,
      ),
      itemCount: photos.length,
      itemBuilder: (context, index) {
        return ListTile(
          // leading: Icon(Icons.album),
          title: Column(  children: [
            Text(photos[index].symbol),
            Padding(padding: EdgeInsets.only(bottom: 10.0)),
            //Text(photos[index].companyName),

          ],
          ),
          subtitle: Column(


            children: [

              Text ('${photos[index].data["quote"]["companyName"] ?? ""}'),
              Text ("Dividend Yield:" '${photos[index].data["stats"]["dividendYield"] ?? ""}'),
              Text ("Last Price:" '${photos[index].data["quote"]["iexBidPrice"]?? ""}'),
              Text ("Last Price:" '${photos[index].data["stats"]["latestPrice"]?? ""}'),

              //


            ],
          ),
        );
      },
    );
  }
}

Data Table:
from: https://github.com/iampawan/FlutterWidgets/blob/master/lib/Episode5_DataTable/datatable_example.dart

Widget bodyData() => DataTable(
      onSelectAll: (b) {},
      sortColumnIndex: 1,
      sortAscending: true,
      columns: <DataColumn>[
        DataColumn(
          label: Text("First Name"),
          numeric: false,
          onSort: (i, b) {
            print("$i $b");
            setState(() {
              names.sort((a, b) => a.firstName.compareTo(b.firstName));
            });
          },
          tooltip: "To display first name of the Name",
        ),
        DataColumn(
          label: Text("Last Name"),
          numeric: false,
          onSort: (i, b) {
            print("$i $b");
            setState(() {
              names.sort((a, b) => a.lastName.compareTo(b.lastName));
            });
          },
          tooltip: "To display last name of the Name",
        ),
      ],
      rows: names
          .map(
            (name) => DataRow(
                  cells: [
                    DataCell(
                      Text(name.firstName),
                      showEditIcon: false,
                      placeholder: false,
                    ),
                    DataCell(
                      Text(name.lastName),
                      showEditIcon: false,
                      placeholder: false,
                    )
                  ],
                ),
          )
          .toList());

Thank you!
😊


Get this bounty!!!

#StackBounty: #flutter Changes made to app are not being retained once run session ends

Bounty: 50

Let’s say I’m connected to an actual device, making multiple changes to my app and hot-reload/restart is doing its thing and life’s all good. Once I’m satisfied with changes I hit the stop button.

Now, if I pick up the phone and launch the app – it will be an older version of the app that doesn’t contain the changes just implemented.

In order to get most recent changes I have to uninstall app from the phone and then go back into the IDE (VSC) and run the app once more to get the latest changes.

Is there a configuration setting that allows you to avoid having to do this?


Get this bounty!!!

#StackBounty: #android #flutter #dart Execution failed for task ':flutter_twitter:verifyReleaseResources'

Bounty: 100

I’m working on Flutter app. I can run app in the android device successfully but try to make build (.apk) file and got below issues.

FAILURE: Build failed with an exception.                                                                           

* What went wrong:                                                                                                 
Execution failed for task ':flutter_twitter:verifyReleaseResources'.                                               
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade                  
   > Android resource linking failed                                                                               
     /Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     /Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.


* Try:                                                                                                             
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org                                                                         

BUILD FAILED in 5m 2s                                                                                              
Running Gradle task 'assembleRelease'...                                                                           
Running Gradle task 'assembleRelease'... Done                     303.8s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin firebase_messaging...
The plugin firebase_messaging could not be built due to the issue above.

Below are project’s stuffs

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.xxxx.eeee"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

> local.properties

sdk.dir=/Users/ipatel/Library/Android/sdk
flutter.sdk=/Users/ipatel/Documents/Amit/FlutterSetup/flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.ver

My app is compatible with AndroidX and also tried with many solution but can’t able to fix my issue.

I checked
https://github.com/roughike/flutter_twitter_login/issues/29
A failure occurred while executing com.android.build.gradle.internal.tasks
flutter Error "Android dependency 'androidx.core:core' has different version" using flutter_local_notifications and location packages

and others.

Flutter Doctor Result:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Mac OS X 10.14.3 18D109, locale en-IN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (4 available)

~PS : Let me know if you want more details from my end.


Get this bounty!!!

#StackBounty: #r #flutter #webview #flutterwebviewplugin DataCamp Light not working in flutter webview

Bounty: 50

I’m writing an app that displays a WebView in Flutter. For this purpose I added the webview_flutter package to my pubspec.yaml like this:

  dependencies:
    webview_flutter: "^0.3.18+1"

I want to display this url: https://cran.r-project.org/web/packages/tutorial/vignettes/tutorial-basics.html

so I did the following:

class WebViewExample extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        body: Container(
            child: WebView(
              initialUrl: 'https://cran.r-project.org/web/packages/tutorial/vignettes/tutorial-basics.html',
              javascriptMode: JavascriptMode.unrestricted,
              userAgent: "Google Chrome Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36.",
            )
        )
    );

  }
}

Everything works as expected except when I try to run the R code. The Datacamp fiddle tries to setup the workspace but then I get: “Your session has been disconnected” although It works well in the browser.

enter image description here

I also tried with the flutter_webview_plugin with the same result.

Any advise to run this?


Get this bounty!!!

#StackBounty: #flutter #dart #stack #pie-chart Pie-Chart flutter

Bounty: 50

I’m using pie_chart library to draw pie-chart in my flutter project.

Does anyone know how to add the text in the center of pie, and increase the arc width?

Edit

 return PieChart(
                              dataMap: dataMap,
                              animationDuration: Duration(milliseconds: 800),
                              chartRadius:
                                  MediaQuery.of(context).size.width / 1.7,
                              showChartValuesInPercentage: true,
                              showChartValues: true,
                              showChartValuesOutside: true,
                              chartValueBackgroundColor: Colors.grey[200],
                              colorList: colorList,
                              showLegends: true,
                              legendPosition: LegendPosition.right,
                              decimalPlaces: 1,
                              showChartValueLabel: true,
                              chartType: ChartType.ring,
                              centerText: "Title",
                            );


Get this bounty!!!

#StackBounty: #listview #flutter #flutter-layout How to pass Taps to widgets below the top widget?

Bounty: 50

I’m trying to implement a very simple version of Card Paginator Component (single card) in Flutter.

Here is an example of a basic demo I’ve created:

class CardComponent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Positioned(
          top: 20.0,
          left: 20.0,
          child: 
          GestureDetector(
          // onTap should run while the text is visible on the screen
          // The text will become invisible when the Listview gest scrolled upwards
          onTap: (){print('text tapped');},
            child:
          Container(
          alignment:Alignment.topCenter,
          color: Colors.blueAccent,
        // This is fixed Text over which the card should scroll
        child: Text('Test Button')))),
        ListView(
          children: [
            //  This margin in first empty container pushes the whole card downward and makes the 'Test Button visible'
            Container(margin: EdgeInsets.only(top: 50.0)),
            // This is where the scrolling card actually starts
            Container(color: Colors.cyan[100], height: 120.0, width: 20.0),
            Container(color: Colors.cyan, height: 120.0, width: 20.0),
            Container(color: Colors.cyan[100], height: 120.0, width: 20.0),
            Container(color: Colors.cyan, height: 120.0, width: 20.0),
            Container(color: Colors.cyan[100], height: 120.0, width: 20.0),
            Container(color: Colors.cyan, height: 120.0, width: 20.0),
          ]
        )
      ],
    );
  }
}

The issue I’m facing is, I’m unable to click the button when the card in not scrolled up. The fixed ‘Test Button’ is visible on the screen because of the empty dummy Container pushing the scrollable ListView downwards. Yet, since the ListView covers the full screen by default, hence the onTap never runs on tapping the button when it’s visible.

enter image description here

If I surround the ListView/SinglleChildScrollView with IgnorePointer class, the whole scrolling behaviour stops and also any taps to the children of the ListView stops working which is not desired.

How to tap on the button (backward widget in Stack) while allowing scrolling/tapping in ListView? Or should I approach building Card Paginator Component is some different way?


Get this bounty!!!

#StackBounty: #flutter #flutter-layout How to get offset from CustomScrollView inside NestedScrollView

Bounty: 100

I have got a NestedScrollView with a SliverAppBar. The body of the NestedScrollView is a widget with a CustomScrollView with a SliverList.

I want to get the offset from the ScrollController that is given to the NestedScrollView but it only gives me the offset until the SliverAppBar is out of view, after that the SliverList continues to scroll but the ScrollController doesn’t give the offset.

NestedScrollView(
  headerSliverBuilder: (_, __) => SliverAppBar(..),
  body: CustomScrollView(..),
)

The CustomScrollView will automatically use the PrimaryScrollController provided by NestedScrollView.
When a listener is attached to that scroll view, it will be called when the SliverAppBar slides into view and out of view until the position.extentAfter is equal to 0.0 and then it will not update at all, no matter how far you scroll down because the extentAfter always remains at 0.0.

How can you retrieve the scroll position of the CustomScrollView inside of the NestedScrollView?


Get this bounty!!!