android - Why does view.bringToFront() doenst work in custom Listview case? - android-widget

I am making a custom listview, in that data is dynamically changing after sometime. this part and click event part of list and list's button is working fine.I have to show some specific row on the top according to text.
I am using view.bringToFront() for showing that row in front. It is not working. How can i do this?? I want if(StatusText.get(position).equalsIgnoreCase("chat request")) if i check this method then this row come to front as top row of the list.
How can I do this?

bringToFront() change the view's z order in the tree, so it's on top of other sibling views (pay attention: Z-order) In your case you should resort your data and call notifyDataChanged for your adapter

I think you can use relative layout with listview and list item layout.Make Listitem layout invisible.After calling that method just make the visiblity of that listitem layout to View.VISIBLE as you are using relative layout you can position the list item layout to top bottom center or anywer.

Related

How to create horizontal list view with faded image by Flutter?

I need a horizontal list view in the flutter , that according to the image below, the first item is empty and the image is visible in the background, when the second item starts scrolling, the background image disappears and when the item returns to its place , The image also returns to the original state.
You will need some code here.
The vertical listview you can get with the SingleChildScroolView changing the axis to vertical and placing a Column inside.
To the empty space on last item, place a Sizedbox as last widget inside Column.
Place a ScrollController on the SingleChildScroolView with a listener, and when the controller reach the maximum just fade in the background image.
Its not hard, just need some code.
Finally, I published Package (flutter_faded_list) for designing this UI on the pub.dev website.

Detect if there are items left to scroll in a flutter Listview

I have listview in a gridview in a flutter calendar app. I am trying to detect if a particular list view has half-visible or invisible items which need to be scrolled to be seen. If not, the user might not see that a day has an appointment/task unless they change resolution/view.
I'd like to add a little arrow, or overlay, just to warn the user there are extra items. Making the listview scrollable doesn't work well for me because then the gridview loses scrollability, unless I make the ListViews shrinkwrap, which causes its own problems.
Any help appreciated...
you can use an Text to tell the user there is more contact and if the list is on end you remove that text
by using this inview_notifier_list package
and check if onListEndReached

Dart/Flutter: change content of container on tab in ListView

I am currently trying to create something like a TabBar. I created a horizontal ListView which should work as the TabBar and I my goal is, that one row fills itself with a list that contains the cards for the Tab I clicked on and refreshes when I click on another one. Is there a way to do that? It should look like this:
Reference Picture
Did you look at Work with tabs, an introduction to TabBar, TabBarView and DefaultTabController?
You could also create it from scratch using a ListView with a Card wrapped in a GestureDetector or a ListTile, and detect taps on onTap, which would set the selected data and update state using setState.

Flutter Not able to achieve PageView like Swipeable Tabs inside Parent ListView

This is a Flutter Specific Query.
I Want to achieve the Layout Referenced in the Image above. Two Tabs
Below a Container.
The Tabs can be switched using Swipe Animation like that in a
Page View.
The Tabs Contain Dynamically Generated Widgets from Provider.
The Entire Page along with the Fixed Container must be
Scroll-able.
When Switching between the Tabs the fixed container should stay
in place and only tab Content(Column of Widgets) should swipe
left and right.
What I've Tried :
Using a Parent List View and Nesting the Fixed Container Child
and Using Tab Bar to switch the Widget using Animated Switcher and
Slide Animation. Here the Problem is i cannot swipe left and right
and create the Page View like Effect. I also tried Nesting Page-View
inside List-View but since the Page-View does not have a fixed height
( because the tab contents are dynamically generated ).
A few many more concepts i tried to tackle but the issue every time was
that the tab contents are not having a fixed height.
I really want to achieve this Layout and i want to know if there's any way.

How to keep the scrolling position when adding a new elements in the top using ListView or CustomScrollView in Flutter

Is it possible to add new elements into the top of the ListVeiw or CustomScrollView and keep the scroll position as it's with Flutter
I've tried the following
extentAfter = _scrollController.position.extentAfter;
_scrollController.jumpTo(_scrollController.position.maxScrollExtent - extentAfter);
but this won't work well with SliverAppBar - floating and its actually not optimal solution.
Actually the cleanest way would be to add those items only when user scrolls back to the top of the ListView. You can cache them in memory for the moment user is far enough from the top (in your case) of the list.