如何减小圆形按钮的半径/尺寸?

时间:2019-05-24 12:39:26

标签: flutter

我想创建一个圆形的按钮。

我通过:p

# -*- coding: utf-8 -*-

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import PIL # not necessary but mustn't fail

# fig setup
fig = plt.figure(figsize=(5,5), dpi=300)
ax = fig.gca(projection='3d')
ax.set_xlim([-1,1])
ax.set_ylim([-1,1])
ax.set_zlim([-1,1])
ax.axes.xaxis.set_ticklabels([])
ax.axes.yaxis.set_ticklabels([])
ax.axes.zaxis.set_ticklabels([])

# draw a surface
xx, yy = np.meshgrid(range(-1,2), range(-1,2))
zz = np.zeros(shape=(3,3))
ax.plot_surface(xx, yy, zz, color='#c8c8c8', alpha=0.3)
ax.plot_surface(xx, zz, yy, color='#b6b6ff', alpha=0.2)

# draw a point
ax.scatter([0],[0],[0], color='b', s=200)

fig.savefig('3dPlot.tif')

但是按钮的尺寸太大,无法使用,我想减小按钮的半径。

2 个答案:

答案 0 :(得分:0)

您应该为constraints使用RawMaterialButton属性来更改大小。

  

约束属性

     

BoxConstraints约束最终

     

定义按钮的大小。

     

通常用于限制按钮的最小大小。

答案 1 :(得分:0)

尝试设置所需的值,而不是下面的代码片段中的15。

RawMaterialButton(
                constraints: BoxConstraints(minWidth: 15, minHeight: 15),
                onPressed: () {},
                shape: CircleBorder(),
                fillColor: Colors.white,
              )
相关问题