mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Adds ai_recipe_generation sample (#2242)
Adding the demo app from my I/O talk. Because AI. ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] All existing and new tests are passing. --------- Co-authored-by: Brett Morgan <brett.morgan@gmail.com>
This commit is contained in:
52
ai_recipe_generation/lib/widgets/appbar_shape_border.dart
Normal file
52
ai_recipe_generation/lib/widgets/appbar_shape_border.dart
Normal file
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppBarShapeBorder extends ShapeBorder {
|
||||
final double radius;
|
||||
|
||||
const AppBarShapeBorder(this.radius);
|
||||
|
||||
@override
|
||||
EdgeInsetsGeometry get dimensions => EdgeInsets.zero;
|
||||
|
||||
@override
|
||||
Path getInnerPath(Rect rect, {TextDirection? textDirection}) {
|
||||
return Path(); // Define inner path if needed
|
||||
}
|
||||
|
||||
@override
|
||||
Path getOuterPath(Rect rect, {TextDirection? textDirection}) {
|
||||
// Define your custom shape path here
|
||||
Path path = Path();
|
||||
path.moveTo(rect.left, rect.top);
|
||||
path.lineTo(rect.left, rect.bottom - (radius * 2));
|
||||
|
||||
path.quadraticBezierTo(
|
||||
rect.left,
|
||||
rect.bottom - radius,
|
||||
rect.left + radius,
|
||||
rect.bottom - radius,
|
||||
);
|
||||
|
||||
path.lineTo(rect.right - radius, rect.bottom - radius);
|
||||
|
||||
path.quadraticBezierTo(
|
||||
rect.right, rect.bottom - radius, rect.right, rect.bottom);
|
||||
|
||||
path.lineTo(rect.right, rect.top);
|
||||
path.close();
|
||||
return path;
|
||||
}
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) {
|
||||
// Define your painting logic here
|
||||
Paint paint = Paint()..color = Colors.transparent;
|
||||
canvas.drawPath(getOuterPath(rect), paint);
|
||||
}
|
||||
|
||||
@override
|
||||
ShapeBorder scale(double t) {
|
||||
// Implement scaling if needed
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user