Skip to content

Instantly share code, notes, and snippets.

@SteveOye
Created January 17, 2024 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteveOye/b4cc896c1c273e20ce2b82f43e122ef0 to your computer and use it in GitHub Desktop.
Save SteveOye/b4cc896c1c273e20ce2b82f43e122ef0 to your computer and use it in GitHub Desktop.
List
import 'package:app/src/common_widgets/app_bar_text_title.dart';
import 'package:app/src/constant/app_colors.dart';
import 'package:app/src/utils/size_config.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../common_widgets/wallet_cards.dart';
import '../../constant/app_assets.dart';
class TransactionHistoryScreen extends StatefulWidget {
const TransactionHistoryScreen({super.key});
@override
State<TransactionHistoryScreen> createState() =>
_TransactionHistoryScreenState();
}
class _TransactionHistoryScreenState extends State<TransactionHistoryScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const PreferredSize(
preferredSize: Size.fromHeight(50.0),
child: AppBarTextTitle(
title: 'Transaction History',
),
),
body: Container(
color: AppColors.miscWhite,
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Text(
'Transactions',
style: TextStyle(
fontFamily: 'TomatoGrotesk',
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: getProportionateScreenHeight(8),
),
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
decoration: const BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.all(
Radius.circular(16),
)),
child: Center(
child: SizedBox(
child: ListView.builder(
shrinkWrap: true,
itemCount: 2,
itemBuilder: (context, index) {
return Container(
color: Colors.amberAccent,
child: Text('Here'),
);
},
),
),
),
),
],
),
),
);
}
}
@thisFemi
Copy link

Remove the Center and Sizebox above the listview, then use expanded instead

@SteveOye
Copy link
Author

Nothing changes @thisFemi

@thisFemi
Copy link

Turn shrinkwrap to false… most times ListTile are always used inside a listview unless you have your own need for modification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment