0
I’m trying to build a video player. However I’m not getting to leave the button the way I’d like.
It’s like I need to "extend" the size of the button so that the intersection point of borderRadius reaches the desired location.
1º Picture first frame is how the button is getting using Radius.Elliptical
1º Second frame image is how I’d like it to look
2º Image is an illustration of the total circumference of the object pro point of intersection within aspectRatio
3rd Image is what happens if I only use a circular Radius.
Below the code:
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() => runApp(
MaterialApp(
home: PlayerLayout(),
)
);
class PlayerLayout extends StatefulWidget {
@override
_PlayerLayoutState createState() => _PlayerLayoutState();
}
class _PlayerLayoutState extends State<PlayerLayout> {
BorderRadius borderStyle;
@override
void initState() {
// TODO: implement initState
super.initState();
borderStyle = BorderRadius.only(
topLeft: Radius.elliptical(60, 120),
bottomLeft: Radius.elliptical(60, 120),
);
}
Widget forwardBackward(angle){
return Transform.rotate(
angle: angle,
child: Container(
child: Material(
shape: RoundedRectangleBorder(
borderRadius: borderStyle
),
child: new InkWell(
borderRadius: borderStyle,
onTap: (){print("tapped");},
child: Stack(
children: <Widget>[
Positioned.fill(
left: -32,
child: Icon(
Icons.play_arrow,
size: 38,
),
),
Positioned.fill(
left: 0,
child: Icon(
Icons.play_arrow,
size: 38,
),
),
Positioned.fill(
left: 32,
child:Icon(
Icons.play_arrow,
size: 38,
),
)
],
)
),
color: Colors.transparent,
),
decoration: BoxDecoration(
color: Colors.green,
borderRadius: borderStyle
),
height: double.infinity,
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
top: true,
child: Column(
children: <Widget>[
AspectRatio(
aspectRatio: 16/9,
child: Container(
color: Colors.black,
child: Row(
children: <Widget>[
Expanded(
child: forwardBackward(180 * math.pi / 180),
),
Expanded(
child: forwardBackward(360 * math.pi / 180),
),
],
),
),
),
],
),
),
);
}
}
Does anyone know how I can make it equal in the second picture?
You seem to be an old-fashioned user already, so please edit your question and enter your code here in your question for us! It is more practical to help you and follows the pattern of the site...
– Matheus Ribeiro
@Matheusribeiro did as you advised and I added some more information! I hope it became clearer!
– ivan veloso