how can i make a progress indicator using flutter? - flutter

the result i want to achieve
how can i make a progress indicator using flutter?
I've tried using Flutter's built-in progress indicator but it's not what I want
https://api.flutter.dev/flutter/material/CircularProgressIndicator-class.html
I've used it before, something went wrong. when I move pages (from home to settings) and back again to the home page. home page doesn't reload when I delete ProgressIndicator home page works fine

For tour purposes you can use percent_indicator library

Stack(
alignment: Alignment.center,
children: const [
SizedBox(
width: 45,
height: 45,
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
Color(0XFFA81E61),
),
backgroundColor: Color(0XFFeab5b5),
value: 0.5,
),
),
Text('1 / 2')
],
)

Related

Flutter app UI disappears after restarting once in apk release

After downloading the app through the apk release, in the first time, it works normally. But once you close the app and open it again, the ui elements disappears. It has a very strange behavior, if I restart the device, it works in the first time the app is open (after the restart), and after closing it, it doens't work again.
This only happens in the release version, debugging works as expected.
I am using Getx, I don't see a relation since I have already develop other apps with this structure. This is the code of the first page loaded.
return Container(
constraints: BoxConstraints(minWidth: Get.width, minHeight: Get.height),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
image: DecorationImage(
opacity: 0.35,
repeat: ImageRepeat.repeat,
image: AssetImage(AppConstants.assets.background_image),
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
body: Container(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: Get.width,
height: Get.height * 0.45,
child: Center(
child: Padding(
padding: const EdgeInsets.only(top: 80.0),
child: SizedBox(
width: Get.width * 0.8,
height: Get.height * 0.3,
child: Image.asset(AppConstants.assets.logo_image),
),
),
),
),
SizedBox(
height: Get.height * 0.55,
child: TabBarView(
controller: controller.tabController,
physics: NeverScrollableScrollPhysics(),
children: [
TelephoneTab(),
CodeTab(),
],
),
),
],
),
),
),
),
);
I have tried removing the background image by removing the Container before the Scaffold entirely, removing every element in the UI and adding just a small button in the middle. Updating my kotlin.
Tried running with flutter run --release. No logs.
May be the same thing as this.
Flutter doctor is fine.
The problem seems to be something related to the Scaffold and the Container with the background image. Elements outside the Scaffold were drawn as usual.
I changed the first page of the app in order to go directly to the HomePage and it worked fine, even logging out to the LoginPage.
Then I tried creating a SplashPage before the LoginPage, initially, I used the same structure with the Container, BoxDecoration, and Scaffold. The problem was happening again, but this time in the SplashPage, everything inside the Scaffold was invisible with the same behavior as mentioned above.
After that, I simply define the extendBody as true in the Scaffold of the SplashPage and the problem stopped occurring.
I don't exactly understand what this changes. Feel free to add an explanation to this answer.

How Flutter adds a top-level view (similar to iOS adding to a window)

The widget is always displayed on the screen, just like in iOS, adding controls to the window. How to achieve it, thank you! Grateful!
Add this to your MaterialApp to remove it
MaterialApp(
debugShowCheckedModeBanner: false,
)
You can use Banner widget that actually displays debug banner.
docs link : https://api.flutter.dev/flutter/widgets/Banner-class.html
Banner(
location: BannerLocation.topEnd,
message: "",
child: Icon(Icons.help), //you can pass anything here as widget
color: Colors.transparent,
),
Have a look at this. Flutter provides a default Banner widget.It is somewhat similar to the debug banner what we are used to of seeing on the top-right corner on a flutter app in debug mode.
https://api.flutter.dev/flutter/widgets/Banner-class.html
You can use Stack Widget to overlay Widgets over one another. For example:
Stack(
children: <Widget>[
Container(
width: 100,
height: 100,
color: Colors.red,
),
Container(
width: 90,
height: 90,
color: Colors.green,
),
Container(
width: 80,
height: 80,
color: Colors.blue,
),
],
)
The Banner widget realises this by creating a CustomPainter, take a look at the Implementation. But I think a Stack would be the better choice here if you are using Widgets.

How to make text look like its going out of screen

I am making my app in which I want the font to look like its going out of the screen or has been cut off. I am unable to find anything in flutter related to it. If anyone knows about it please check the picture and let me know if its possible then how can I make it.
try this:
return Scaffold(
body: Transform.scale(
scaleX: 1.3,
child: Container(
color: Colors.blueGrey,
transform: Matrix4.translationValues(
7.0, 50.0, 0.0),
child: Text('Groupp',
style: TextStyle(fontSize: 100),
),
),
),
);

Is it possible to Repeat Icons in flutter like ImageRepeat

I am wondering if it is possible to repeat an actual icon widget like the image I have attached.
Currently getting this result using ImageRepeat but would like to be able to use and actual icon so it can be modular and the icon can change.
( the repeating image can currently change but I don't want to have to create 100 images of icons. )
Current Solution:
SizedBox.expand(
child: Image.asset(
_backGroundImage,
repeat: ImageRepeat.repeat,
)),
try Wrap:
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.orange,
child: Wrap(
children: List<Widget>.generate(2000, (int index) {
return Icon(Icons.add);
}),
),
),

loading icon before SVG image Loading

i am created an SVG image for background, but it is loaded after some time, the issue is:
when it is not loaded yet all widgets appears randomly. i just need a loader after the image loaded it page widget appears.
the code is:
Scaffold(
appBar: const _CustomNotificationAppBar(),
body: isFinished
? SingleChildScrollView(
child: Stack(
children: [
//notification background
Opacity(
opacity: 0.42,
child: SvgPicture.asset(
'assets/images/notification_background.svg',
),
),
IconButton(
icon: const Icon(
Icons.notifications_active_outlined,
),
onPressed: () {})),
],
),
)
: const Center(
child: CircularProgressIndicator(),
),
);
well if I understands you well and as long as your SVG is loading from the device "asset",
there should not be delay in first place.
I think the problem is you emulator or physical device is too slow , And you may face this problem in debug only
try to run flutter build APK and install that generated APK in your phone and check if problem remains.
however you can achieve that also like this
SvgPicture.asset(
'assets/images/notification_background.svg',
placeholderBuilder: (context) => Text("I am Loading"),
),
You can wrap it in a Container, and it will work.
For eg:
Container(
//height :desired height,
//width : desired width
child: Opacity(
opacity: 0.42,
child: SvgPicture.asset(
'assets/images/notification_background.svg',
),
))
You can pass a placeholderBuilder to your SvgPicture.asset like this:
SvgPicture.asset(
'assets/images/notification_background.svg',
placeholderBuilder: (context) => Icon(Icons.your_desired_icon),
),
You can also wrap the Icon with a SizedBox if you need to comply with a certain size, or replace it by any other widget that you wish.
More info about the widget you're using is available in its API docs.