AppBarWidget<T> constructor

const AppBarWidget<T>({
  1. Key? key,
  2. required String title,
  3. SearchBarConfig<T>? isShowSearchBar()?,
  4. bool isShowSearchIcon = true,
  5. Color backgroundColor = Colors.blue,
  6. Color iconColor = Colors.white,
  7. TextStyle? titleStyle,
  8. double height = kToolbarHeight,
  9. Widget? loadingWidget,
  10. BorderRadiusGeometry borderRadius = const BorderRadius.all(Radius.circular(0)),
  11. EdgeInsetsGeometry padding = const EdgeInsets.all(0),
})

A highly customizable SearchBar widget with overlay results.

Example usage:

AppBarWidget<User>(
  title: "Users",
  isShowSearchBar: () => SearchBarConfig<User>(
    url: "https://jsonplaceholder.typicode.com/users",
    fromJson: User.fromJson,
    searchBackgroundColor: Colors.white,
    searchBy: (user) => user.name,
    itemBuilder: (user) => ListTile(
      leading: CircleAvatar(child: Text(user.name[0])),
      title: Text(user.name),
      subtitle: Text(user.email),
      onTap: () => debugPrint("Selected: ${user.name}"),
    ),
  ),
)


class User {
  final int id;
  final String name;
  final String email;

  User({required this.id, required this.name, required this.email});

  factory User.fromJson(Map<String, dynamic> json) {
    return User(
      id: json['id'],
      name: json['name'],
      email: json['email'],
    );
  }
}

Implementation

const AppBarWidget({
  super.key,
  required this.title,
  this.isShowSearchBar,
  this.isShowSearchIcon = true,
  this.backgroundColor = Colors.blue,


  this.iconColor = Colors.white,
  this.titleStyle,
  this.height = kToolbarHeight,
  this.loadingWidget,
  this.borderRadius = const BorderRadius.all(Radius.circular(0))
  ,  this.padding=const EdgeInsets.all(0),
});