Skip to content

Instantly share code, notes, and snippets.

@VB10
Created January 11, 2024 21:21
Show Gist options
  • Save VB10/bc2657cea811e9224bd797aef2a4fa19 to your computer and use it in GitHub Desktop.
Save VB10/bc2657cea811e9224bd797aef2a4fa19 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:vbaseproject/features/v2/demo/home_veli_view.dart';
mixin HomeVeliMixin on State<HomeVeliView> {
void showErrorMessage();
void fetchUserDeteail({required String id}) {
const response = true;
if (!response) return;
showErrorMessage();
}
}
import 'package:flutter/material.dart';
import 'package:vbaseproject/features/v2/demo/home_veli_mixin.dart';
class HomeVeliView extends StatefulWidget {
const HomeVeliView({super.key});
@override
State<HomeVeliView> createState() => _HomeVeliViewState();
}
class _HomeVeliViewState extends State<HomeVeliView> with HomeVeliMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: () => fetchUserDeteail(id: 'vb'),
),
appBar: AppBar(
title: const Text('Veli'),
),
body: const Center(
child: Text('Veli'),
),
);
}
@override
void showErrorMessage() {
{
showDialog<bool>(
context: context,
builder: (context) {
return const Text('Olley hsogeldin');
},
);
}
}
}
@VB10
Copy link
Author

VB10 commented Jan 11, 2024

This is a sample about delegation for flutter

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