Why CustomClipper is not working suddenly? - dart

I'm studying clipping image as curve, but CustomClipper is not working suddenly.
Only clipper property of IreneClipper not works. How can I fix it?
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Clock',
theme: ThemeData(
primarySwatch: Colors.blue
),
home: IreneClip(),
);
}
}
class IreneClip extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(backgroundColor: Colors.orange,),
body: ClipPath(
child: Image.asset('assets/irene.jpg'),
clipper: IreneClipper(),
),
);
}
}
class IreneClipper extends CustomClipper<Path> {
#override
Path getClip(Size size) {
Path path = Path();
path.moveTo(0.0, size.height);
return Path();
}
#override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}
Error message
I/flutter (25014): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY
╞═════════════════════════════════════════════════════════ I/flutter
(25014): The following assertion was thrown during performLayout():
I/flutter (25014): The _ScaffoldLayout custom multichild layout
delegate forgot to lay out the following child: I/flutter (25014):
_ScaffoldSlot.body: RenderClipPath#ab20f NEEDS-LAYOUT NEEDS-PAINT I/flutter (25014): Each child must be laid out exactly once. I/flutter
(25014): I/flutter (25014): When the exception was thrown, this was
the stack: I/flutter (25014): #0
MultiChildLayoutDelegate._callPerformLayout.
(package:flutter/src/rendering/custom_layout.dart:222:13) I/flutter
(25014): #1 MultiChildLayoutDelegate._callPerformLayout
(package:flutter/src/rendering/custom_layout.dart:230:8)
Flutter doctor
[√] Flutter (Channel beta, v1.0.0, on Microsoft Windows [Version 10.0.17134.472], locale ko-KR)
• Flutter version 1.0.0 at C:\flutter
• Framework revision 5391447fae (5 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at C:\AndroidSDK
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = C:\AndroidSDK
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[√] Android Studio (version 3.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 31.3.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[!] IntelliJ IDEA Community Edition (version 2018.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.io/intellij-setup/#installing-the-plugins
[!] VS Code, 64-bit edition (version 1.30.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

I solved, shouldReclip method must return true if you want to hot reload clipping image.
class IreneClipper extends CustomClipper<Path> {
#override
Path getClip(Size size) {
Path path = Path();
path.lineTo(0.0, size.height-40);
path.lineTo(size.width, size.height-60);
path.lineTo(size.width, 0.0);
path.close();
return path;
}
#override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return true;
}
}

You need to wrap it with like:
Column(
children: [
SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
Stack(
clipBehavior: Clip.none,
children: <Widget>[
// stack overlaps widgets
ClipPath(
clipper: YOURCUSTOMCLIPPER(),
child: Container(
width: MediaQuery.of(context).size.width,
height: 140,
color: Colors.red,
),
),
],
),
],
),
),
),
],
),

Related

flutter video_player is not working on IOS devices. Even though it works on android devices

I'm trying to use video_player in flutter to show network videos in mp4 format (https://www.heygold.com/media/reel/ThisorThat.mp4). On IOS devices it never sets _controller.value.isInitialized to true.
I'm using:
video_player: 2.4.7
Output of flutter doctor -v:
[✓] Flutter (Channel stable, 3.3.9, on macOS 12.6 21G115 darwin-arm, locale en-DE)
• Flutter version 3.3.9 on channel stable at /Users/casparbaumeister/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b8f7f1f986 (2 weeks ago), 2022-11-23 06:43:51 +0900
• Engine revision 8f2221fbef
• Dart version 2.18.5
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/casparbaumeister/Library/Android/sdk
• Platform android-33, build-tools 32.1.0-rc1
• Java binary at: /Users/casparbaumeister/development/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Users/casparbaumeister/development/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.73.1)
• VS Code at /Users/casparbaumeister/development/Visual Studio Code.app/Contents
• Flutter extension version 3.54.0
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 32) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.94
[✓] HTTP Host Availability
• All required HTTP hosts are available
Video player page:
class ReelsPage extends StatefulWidget {
const ReelsPage({Key? key, required this.videoUrl}) : super(key: key);
final String videoUrl;
#override
_ReelsPageState createState() => _ReelsPageState();
}
class _ReelsPageState extends State<ReelsPage> {
late VideoPlayerController _controller;
#override
void initState() {
super.initState();
_controller = VideoPlayerController.network(widget.videoUrl)
..addListener(() => setState(() {}))
..setLooping(true)
..initialize().then((_) => _controller.play());
}
#override
void dispose() {
_controller.dispose();
super.dispose();
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios_new_rounded, color: GOLDISH),
onPressed: () {
Navigator.of(context).pop();
},
),
automaticallyImplyLeading: true,
backgroundColor: Colors.black,
elevation: 0,
),
body:
_controller.value.isInitialized
? show video
: Loading <- never leaves this state
)
);
}
}
My info.plist includes the following lines:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
It works totally fine on android emulator and device. I know that it doest work on IOS emulators, but it also does not work on IOS devices. Every help is welcomed, also recommendations for other video player packages! Thanks in regard.

Flutter (web) Provider not working in released mode, but working in debug

I'm experiencing some odd behavior where a Provider behaves differently in debug vs. release mode.
This question is posted in off this question.
Here is a short description of the functionality: I have a list of ExpansionTiles (containing TextFormFields in their body) and a FloatingActionButton that adds to the list of ExpansionTiles. Below those two widgets I have one Back button and one Next button. The Next button needs be "unavailable" (ie. throw an error message to the user and have the color grey) as long as any TextFormField in the list of ExpansionTiles is incomplete. Once all TextFormFields are ready the Next button should change color and direct the user to a new page. Changing the color and functionality works fine in debug, but not in release mode (ie. after running: flutter build web).
Firstly: TravelProceedModel monitors the status of whether the user can click the Next button or not. Ie. this is just a simple bool. Whenever updateCanProceed() is called I update canProceed and also notifyListeners().
import 'package:flutter/material.dart';
class TravelProceedModel extends ChangeNotifier {
bool canProceed;
void updateCanProceed(bool value) {
canProceed = value;
notifyListeners();
}
}
Secondly, the TravelProceedModel is implemented using the ChangeNotifierProvider and then using Consumer. I'm expecting (and this works in debug) that when canProceed is changed this line: "nextEnabled: proceedModel.canProceed" should cause the button the change color. However, this only works in debug mode.
class TravelDeductionTrips extends StatefulWidget {
#override
_TravelDeductionTripsState createState() => _TravelDeductionTripsState();
}
class _TravelDeductionTripsState extends State<TravelDeductionTrips> {
#override
Widget build(BuildContext context) {
String year = Provider.of<UserSelectionsModel>.(context).selected_report["year"];
String report = Provider.of<UserSelectionsModel>(context).selected_report["report"];
return MultiProvider(
providers: [
ChangeNotifierProvider(
create: (context) => TravelProceedModel()
),
ChangeNotifierProvider(
create: (context) => TravelModel(
year: year,
report: report,
),
),
],
child: Consumer<TravelModel>(
builder: (context, travelModel, child) {
return FutureBuilder(
future: travelModel.fetchTripsToLocalSession(),
builder: (context, data) {
if (data.connectionState == ConnectionState.done) {
return Column(
children: <Widget>[
TravelDeductionTripList(),
Consumer<TravelProceedModel>(
builder: (context, proceedModel, child) {
proceedModel.updateCanProceed(
travelModel.checkProceedCondition()
);
return BackNextButtons(
backEnabled: true,
nextEnabled: proceedModel.canProceed,
backText: "Tilbage",
nextText: travelModel.trips["next_action_title"],
errorMessage: travelModel.proceedErrorMessage,
nextFunction: () async {
await addQuestionIDtoStack(year, report, travelModel.trips["next_question_id"], true);
}, // No special function is needed, this is just a simple next
);
},
),
],
);
} else {
return Center(
child: CircularProgressIndicator(),
);
}
}
);
}
),
);
}
}
NB! proceedModel.canProceed is updated from within TravelDeductionTripList() which calls
Provider.of<TravelProceedModel>(context, listen: false).updateCanProceed(
Provider.of<TravelModel>(context, listen: false).checkProceedCondition()
);
The Next button only changes colors after reloading the widget. Ie. it appears that the TravelProceedModel is being updated but that the widget is not being redrawn in the UI - although it happens perfectly in debug mode.
Does anybody have any idea why debug works but release does not?
Below is my "flutter doctor -v". Notice, that this is a flutter web project.
[✓] Flutter (Channel beta, v1.15.17, on Mac OS X 10.15.2 19C57, locale en-US)
• Flutter version 1.15.17 at /Users/danni/Documents/flutter/flutter
• Framework revision 2294d75bfa (13 days ago), 2020-03-07 00:28:38 +0900
• Engine revision 5aff311948
• Dart version 2.8.0 (build 2.8.0-dev.12.0 9983424a3c)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/danni/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used
to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see
https://github.com/flutter/flutter/issues/14293.
To re-install CocoaPods, run:
sudo gem install cocoapods
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 41.0.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.43.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.8.1
[✓] Connected device (2 available)
• Chrome • chrome • web-javascript • Google Chrome 80.0.3987.149
• Web Server • web-server • web-javascript • Flutter Tools
! Doctor found issues in 1 category.
I had the same problem, and I've made a workaround for it.
Since listen is a parameter, you can pass any other bool variable to it (should not be a constant true or false).
There is a built-in bool variable in foundation.dart package called kReleaseMode.
So here is an example, how i handled this listener problem between debug and release mode:
await Provider.of<AuthService>(context, listen: kReleaseMode).loginUser(
user: _username, password: _password);
For me, it works perfectly.

Why is Deep Link Web URL query is empty

Using Flutter and Firebase dynamic links, I am able to create a link. When it is clicked it opens the app but there is no link data, and no callbacks that a link was clicked is fired. Instead in the Xcode logs I get Deep Link Web URL query is empty Link is copied from the app into Notes, then clicked. Is there anything that I am missing, or what else can I check to get this working?
Firebase Deep Link Web URL query is empty - iOS
Checked this relevant post, but installing the required pod dependencies is not the solution as you can see below in the pod install logs.
Flutter Doctor
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15 19A582a, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
instructions.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.5)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.4)
[!] IntelliJ IDEA Community Edition (version 2019.1.3)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.43.0)
[✓] Connected device (1 available)
! Doctor found issues in 2 categories.
Xcode logs
---- Firebase Dynamic Links diagnostic output start ----
Firebase Dynamic Links framework version 4.0.7
System information: OS iOS, OS version 13.3.1, model iPhone
Current date 2020-03-10 12:46:34 +0000
Device locale en-US (raw en_US), timezone America/Boise
Specified custom URL scheme is com.pitch.links and Info.plist contains such scheme in CFBundleURLTypes key.
AppID Prefix: XXXXXXXXXX, Team ID: XXXXXXXXXX, AppId Prefix equal to Team ID: YES
performDiagnostic completed successfully! No errors found.
---- Firebase Dynamic Links diagnostic output end ----
Runner[366:14705] 6.18.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
Runner[366:14754] 6.18.0 - [Firebase/Analytics][I-ACS800003] Registered an SDK that has already registered. Default flags will be overwritten. SDK name: app_measurement
Runner[366:14754] 6.18.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
Runner[366:14712] Connection 3: received failure notification
Runner[366:14712] Connection 3: failed to connect 12:8, reason -1
Runner[366:14712] Connection 3: encountered error(12:8)
Runner[366:14712] Task <03A1535D-FD13-4872-B14B-6673E202F028>.<2> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
Runner[366:14712] Task <03A1535D-FD13-4872-B14B-6673E202F028>.<2> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={NSUnderlyingError=0x282e21b30 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=https://firebasedynamiclinks-ipv6.googleapis.com/v1/installAttribution?key= AIzaxxxxxxx_xxxxxxxxxx_xxxxxxxxxxxxxxxx, NSErrorFailingURLKey=https://firebasedynamiclinks-ipv6.googleapis.com/v1/installAttribution?key= AIzaxxxxxxx_xxxxxxxxxx_xxxxxxxxxxxxxxxx, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=A server with the specified hostname could not be found.}
Runner[366:14505] [ProcessSuspension] 0x10e4e13b0 - ProcessAssertion::processAssertionWasInvalidated()
Runner[366:14505] [ProcessSuspension] 0x10e4e1410 - ProcessAssertion::processAssertionWasInvalidated()
Runner[366:14707] 6.18.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
Runner[366:14707] 6.18.0 - [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
dismiss = 1;
"is_weak_match" = 1;
}
Runner[366:14505] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
Runner[366:14505] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
Runner[366:14505] Returning local object of class NSString
Runner[366:14505] Can't end BackgroundTask: no background task exists with identifier 14 (0xe), or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
Runner[366:15138] 6.18.0 - [Firebase/Analytics][I-ACS023000] Deep Link Web URL query is empty
apple-app-site-association
{"applinks":{"apps":[],"details":[{"appID":"XXXXXXXXXX.com.pitch.links","paths":["NOT /_/*","/*"]}]}}
applinks:pitchlink.page.link is listed as an Associated Domain
and URL Type with Identifier of Bundle ID and URL Schemes com.pitch.links has been added to the Info.plist
Flutter main.dart
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Dynamic Links',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Dynamic Links'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
#override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Uri dynamicUrl;
#override
void initState() {
super.initState();
this.initDynamicLinks();
}
void initDynamicLinks() async {
final DynamicLinkParameters parameters = DynamicLinkParameters(
uriPrefix: 'https://pitchlink.page.link',
link: Uri.parse('https://example.com/suffix?d=1'),
iosParameters: IosParameters(
bundleId: 'com.pitch.links',
minimumVersion: '0.0.1',
),
);
FirebaseDynamicLinks.instance.onLink(
onSuccess: (PendingDynamicLinkData dynamicLink) async {
final Uri deepLink = dynamicLink?.link;
print(deepLink.toString());
}, onError: (OnLinkErrorException e) async {
print('onLinkError');
print(e.message);
});
ShortDynamicLink link = await parameters.buildShortLink();
setState(() {
dynamicUrl = link.shortUrl;
});
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Dynamic Link:',
),
dynamicUrl != null
? SelectableText(
dynamicUrl.toString(),
)
: Container(),
],
),
),
);
}
}
pubspec.yaml
name: pitch_links
description: A new Flutter project.
version: 0.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_dynamic_links: ^0.5.0+11
firebase_analytics: ^5.0.11
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
pod install --clean-install --verbose
-> Using Firebase (6.18.0)
-> Using FirebaseAnalytics (6.3.0)
-> Using FirebaseAnalyticsInterop (1.5.0)
-> Using FirebaseCore (6.6.3)
-> Using FirebaseCoreDiagnostics (1.2.1)
-> Using FirebaseCoreDiagnosticsInterop (1.2.0)
-> Using FirebaseDynamicLinks (4.0.7)
-> Using FirebaseInstallations (1.1.0)
-> Using Flutter (1.0.0)
-> Using GoogleAppMeasurement (6.3.0)
-> Using GoogleDataTransport (4.0.1)
-> Using GoogleDataTransportCCTSupport (1.4.1)
-> Using GoogleUtilities (6.5.1)
-> Using PromisesObjC (1.2.8)
-> Using firebase_analytics (0.0.1)
-> Using firebase_dynamic_links (0.1.0)
-> Using nanopb (0.3.9011)
The solution that worked to fix my issue was to call await FirebaseDynamicLinks.instance.getInitialLink(); within initDynamicLinks() The same errors still appear in the Xcode logs, but I am able to parse out the link data.

Attempting to set the box constraints of a Row widget in Flutter

Okay, so I'm using Flutter, and trying to set constraints of an entire Row widget to the
width of the screen, NOT set the constraints of each individual part of the row. I've searched
everywhere, and a Row widget does not HAVE a width or max width parameter to set (It sets it to
infinity for some reason) and ONE of the two things inside the row HAS to be a textfield (I'm
developing on iOS so I'm using a CupertinoTextField, but that shouldn't make a difference.
An example of the body of a scaffold widget would be:
body: Container(
constraints: BoxConstraints.tight(new Size(MediaQuery.of(context).size.width, double.infinity)),
child: Row(
children: [
FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
CupertinoTextField(
textInputAction: TextInputAction.done,
keyboardType: TextInputType.text,
onSubmitted: (value) {
notes = value;
},
controller: textInput,
),
],
)
)
As you can imagine, I'm getting unbounded render box errors, as the row is NOT getting bounded
properly, and I have no idea why Flutter won't let me set the counting box for the entire row.
(Or if it does, it's not doing it in the way I'm doing!)
Results of Flutter Doctor -v
[✓] Flutter (Channel master, v1.14.2-pre.20, on Mac OS X 10.15.2 19C57, locale
en-CA)
• Flutter version 1.14.2-pre.20 at /Users/iosdev/Developer/flutter
• Framework revision 91f8d3da32 (2 hours ago), 2020-01-16 18:21:16 +0000
• Engine revision e0fe834288
• Dart version 2.8.0 (build 2.8.0-dev.2.0 009537bbf0)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/iosdev/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (1 available)
• Phillip’s iPhone • 52a4fba45a6767b88e4dddd881201205138cac0e • ios • iOS
13.3
• No issues found!
You just need to wrap your CupertinoTextField with an Expanded widget:
Container(
child: Row(
children: [
FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
Expanded(
child: CupertinoTextField(
textInputAction: TextInputAction.done,
keyboardType: TextInputType.text,
onSubmitted: (value) {
notes = value;
},
controller: textInput,
),
),
],
)
)

NetworkImage does not work to render url

I tried to render a image with the _renderImage method using a NetworkImage but all what shows up is a big red square. When I render with the _renderImage2 method using Image.network it works fine. unfortunatly I need the decorations from and the boder radius of renderImage. Why does it not work?
Container _renderImage(GroupMessageController message) => new Container(
width: 300.0,
margin: const EdgeInsets.all(5.0),
decoration: new BoxDecoration(
borderRadius: const BorderRadius.all(const Radius.circular(25.0)),
image: new DecorationImage(
fit: BoxFit.contain,
image: new NetworkImage(message.mediaUrl.toString()))));
Container _renderImage2(GroupMessageController message) => new Container(
width: 300.0,
child: new Image.network(
message.mediaUrl.toString(),
fit: BoxFit.contain,
),
);
[√] Flutter (on Microsoft Windows [Version 10.0.16299.64], locale en-US, channel alpha)
• Flutter at c:\sdks\flutter
• Framework revision e8aa40eddd (5 weeks ago), 2017-10-17 15:42:40 -0700
• Engine revision 7c4142808c
• Tools Dart version 1.25.0-dev.11.0
[√] Android toolchain - develop for Android devices (Android SDK 27.0.1)
• Android SDK at C:\Users\ride4\AppData\Local\Android\sdk
• Platform android-27, build-tools 27.0.1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[√] Android Studio (version 3.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[√] IntelliJ IDEA Community Edition (version 2017.2)
• Flutter plugin version 19.1
• Dart plugin version 172.4343.25
[√] Connected devices
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
There's a difference between using decoration property and Image widget.
Using decoration of DecoratedBox is like defining a background image of your box. But since your DecoratedBox has no child at all, then it has a default size of 0x0.
On the other hand, Image has a different purpose and will have a size.
edit
return new DecoratedBox(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new NetworkImage("https://displate.com/displates/2017-09-04/7b4f0a94798f5d8c1ea094984c766911_0dc0c70583e9e27897d5c0125acac0c1.jpg?h=357&w=500&v=3"),
),
),
child: new SizedBox(
width: 300.0,
height: 300.0,
),
);

Resources