Last active
August 14, 2022 15:01
-
-
Save daiki1003/3f328756b0eb91a32c29a3505e93f920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AwesomeWidget extends StatelessWidget { | |
const AwesomeWidget({ | |
super.key, | |
}); | |
@override | |
Widget build(BuildContext, context) { | |
void showUserScreen() { | |
// show user screen | |
} | |
Future<void> follow() async { | |
// follow user | |
} | |
Future<void> unfollow() { | |
// unfollow user | |
} | |
void copyUserId() { | |
// copy user id | |
} | |
return ListTile( | |
onLongPress: copyUserId, | |
// こんなウィジェットはないけどイメージで | |
leading: Thumbnail( | |
userId: user.id, | |
onPressed: showUserScreen, | |
), | |
title: GestureDetector( | |
onTap: showUserScreen, | |
Text(user.name), | |
), | |
trailing: ElevatedButton( | |
onPressed: user.isFollowing ? unfollow : follow, | |
child: Text(user.isFollowing ? 'フォローを外す' : 'フォロー'), | |
), | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment